Software

iOS 8 Action Extension Training

Description
1. iOS 8 Action Extension Tech Talk Training Series - 07/18/2014 - Yuichi Fujiki 2. What can you do with extension? ãProvide a program for other apps to use ã Today…
Categories
Published
of 20
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  • 1. iOS 8 Action Extension Tech Talk Training Series - 07/18/2014 - Yuichi Fujiki
  • 2. What can you do with extension? •Provide a program for other apps to use • Today • Action • Share • Photo Editing • Document Provider • Custom Keyboard
  • 3. What can you do with extension? •Provide a program for other apps to use • Today • Action • Share • Photo Editing • Document Provider • Custom Keyboard
  • 4. What can you do with extension? •Provide a program for other apps to use • Today • Action • Share • Photo Editing • Document Provider • Custom Keyboard
  • 5. What can you do with extension? •Provide a program for other apps to use • Today • Action • Share • Photo Editing • Document Provider • Custom Keyboard
  • 6. What can you do with extension? •Provide a program for other apps to use • Today • Action • Share • Photo Editing • Document Provider • Custom Keyboard
  • 7. What can you do with extension? •Provide a program for other apps to use • Today • Action • Share • Photo Editing • Document Provider • Custom Keyboard
  • 8. What can you do with extension? •Provide a program for other apps to use • Today • Action • Share • Photo Editing • Document Provider • Custom Keyboard
  • 9. What you can NOT do with extension •Define custom extension point • Provide extension by itself • Needs to accompany with an ‘app’
  • 10. Other things to note • Extension runs as a separate process from containing app • Also sandboxed • Basically, you can consider extension is a ViewController presented from different extension point
  • 11. Step 0 1.Clone https://github.com/yfujiki/MyPhotoFilter.git 2.% git checkout refs/tags/step0
  • 12. Step 1 1.Add action extension 2.Limit the extension point only to image item • NSExtensionActivationSupportsImageWithMaxCount=1
  • 13. Step 2 Pass image from containing app to extension 1.Present UIActivityViewController specifying the image (“TunnelView”) 2.The initial action extension template already includes the code to display image NSExtensionContext NSExtensionItem NSExtensionItem NSExtensionItem NSItemProvider self.extensionContext inputItems attachments
  • 14. Step 3 Receive image from Photos app 1.Create image from NSURL •Photos app provides image via URL
  • 15. Step 4 Add image filters to extension 1.Let’s just checkout refs/tags/step4 :))
  • 16. Step 5 Pass edited image back to the host app 1. In Extension, package edited image into NSItemProvider and pass to Host App • NSExtensionContext.completeRequestReturningItems(…) 2. In Containing App, unpack passed image • UIActivityViewController.completionItemsHandler = {
 (activityType:String!, animated:Bool, items:[AnyObject]!, error:NSError!) in
 …
 }

  • 17. Step 6 Save edited image to Photos app too 1.Use AssetsLibrary •Photos framework is supposed to replace AssetsLibrary
  • 18. Step 7 Move general use methods to framework 1.Add framework target 2.import YourFrameWork
  • 19. Step 8 Add Safari Extension 1.Add entries in Info.plist • NSExtentionActionvationSupportsWebURLMaxCount = 1 • NSExtensionJavaScriptPreprocessingFile = Action • Also create “Action.js” corresponding to the entry 2. Add run method in Action.js and pass selected DOM information to extension 3. Parse the passed DOM information as plist and obtain image URL 4. Pass the edited image back to Action.js as URL 5. Implement finalize method in Action.js and replace img element with passed URL
  • 20. Where to go from here? • Different media (video, music, text etc) • Different Extension Point • Skip the view • Choose “Request Handling” for Action Type • Share data between your containing app and extension • Use good-old “Open URL” approach and launch app • Use App Group functionality
  • We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks
    SAVE OUR EARTH

    We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

    More details...

    Sign Now!

    We are very appreciated for your Prompt Action!

    x