SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
iOS 8 Action Extension
Tech Talk Training Series
- 07/18/2014 -
Yuichi Fujiki
What can you do with extension?
•Provide a program for other apps to use
• Today
• Action
• Share
• Photo Editing
• Document Provider
• Custom Keyboard
What can you do with extension?
•Provide a program for other apps to use
• Today
• Action
• Share
• Photo Editing
• Document Provider
• Custom Keyboard
What can you do with extension?
•Provide a program for other apps to use
• Today
• Action
• Share
• Photo Editing
• Document Provider
• Custom Keyboard
What can you do with extension?
•Provide a program for other apps to use
• Today
• Action
• Share
• Photo Editing
• Document Provider
• Custom Keyboard
What can you do with extension?
•Provide a program for other apps to use
• Today
• Action
• Share
• Photo Editing
• Document Provider
• Custom Keyboard
What can you do with extension?
•Provide a program for other apps to use
• Today
• Action
• Share
• Photo Editing
• Document Provider
• Custom Keyboard
What can you do with extension?
•Provide a program for other apps to use
• Today
• Action
• Share
• Photo Editing
• Document Provider
• Custom Keyboard
What you can NOT do with extension
•Define custom extension point
• Provide extension by itself
• Needs to accompany with an ‘app’
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
Step 0
1.Clone https://github.com/yfujiki/MyPhotoFilter.git
2.% git checkout refs/tags/step0
Step 1
1.Add action extension
2.Limit the extension point only to image item
• NSExtensionActivationSupportsImageWithMaxCount=1
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
Step 3
Receive image from Photos app
1.Create image from NSURL
•Photos app provides image via URL
Step 4
Add image filters to extension
1.Let’s just checkout refs/tags/step4 :))
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

…

}

Step 6
Save edited image to Photos app too
1.Use AssetsLibrary
•Photos framework is supposed to replace AssetsLibrary
Step 7
Move general use methods to framework
1.Add framework target
2.import YourFrameWork
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
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

Weitere ähnliche Inhalte

Was ist angesagt?

Guardian devexp and_discovery
Guardian devexp and_discoveryGuardian devexp and_discovery
Guardian devexp and_discovery
Ade Oshineye
 

Was ist angesagt? (19)

Building android and i os apps with visual studio
Building android and i os apps with visual studioBuilding android and i os apps with visual studio
Building android and i os apps with visual studio
 
Google IO 2017 Recap
Google IO 2017 RecapGoogle IO 2017 Recap
Google IO 2017 Recap
 
Open Social - Dark Side of the Moon
Open Social - Dark Side of the MoonOpen Social - Dark Side of the Moon
Open Social - Dark Side of the Moon
 
Why choose flutter 2 over flutter 1
Why choose flutter 2 over flutter 1 Why choose flutter 2 over flutter 1
Why choose flutter 2 over flutter 1
 
Getting in the Evernote Trunk
Getting in the Evernote TrunkGetting in the Evernote Trunk
Getting in the Evernote Trunk
 
Monkey Talk
Monkey TalkMonkey Talk
Monkey Talk
 
GAE as Android Test Portal. Part 1.
GAE as Android Test Portal. Part 1.GAE as Android Test Portal. Part 1.
GAE as Android Test Portal. Part 1.
 
Deploying Apps Heroku
Deploying Apps HerokuDeploying Apps Heroku
Deploying Apps Heroku
 
Flutter: Future of App Development
Flutter: Future of App DevelopmentFlutter: Future of App Development
Flutter: Future of App Development
 
Create first-web application-googleappengine
Create first-web application-googleappengineCreate first-web application-googleappengine
Create first-web application-googleappengine
 
ReactJS
ReactJSReactJS
ReactJS
 
Building a design system with (p)react
Building a design system with (p)reactBuilding a design system with (p)react
Building a design system with (p)react
 
Instant Apps potatotips 41
Instant Apps potatotips 41Instant Apps potatotips 41
Instant Apps potatotips 41
 
Evaluation 4
Evaluation 4Evaluation 4
Evaluation 4
 
Apple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewApple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical Overview
 
Building a scalable app factory with Appcelerator Platform
Building a scalable app factory with Appcelerator PlatformBuilding a scalable app factory with Appcelerator Platform
Building a scalable app factory with Appcelerator Platform
 
Guardian devexp and_discovery
Guardian devexp and_discoveryGuardian devexp and_discovery
Guardian devexp and_discovery
 
Flutter
FlutterFlutter
Flutter
 
Devnest 110802
Devnest 110802Devnest 110802
Devnest 110802
 

Ähnlich wie iOS 8 Action Extension Training

Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Thinkful
 
Question 4 How did you use media technologies in the construction and researc...
Question 4 How did you use media technologies in the construction and researc...Question 4 How did you use media technologies in the construction and researc...
Question 4 How did you use media technologies in the construction and researc...
Nay4697
 
How to Access and Use Gemini API for Free.pptx
How to Access and Use Gemini API for Free.pptxHow to Access and Use Gemini API for Free.pptx
How to Access and Use Gemini API for Free.pptx
ujjwalsoni23
 

Ähnlich wie iOS 8 Action Extension Training (20)

iOS 8 App Extensions
iOS 8 App ExtensionsiOS 8 App Extensions
iOS 8 App Extensions
 
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
 
Gigigo Workshop - iOS Extensions
Gigigo Workshop - iOS ExtensionsGigigo Workshop - iOS Extensions
Gigigo Workshop - iOS Extensions
 
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Unity and Microsoft Azure Cognitive Services - DIGITREK21 WorkshopUnity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
 
Evaluation how did you use media technologies
Evaluation   how did you use media technologiesEvaluation   how did you use media technologies
Evaluation how did you use media technologies
 
Building a mobile app connected to WordPress with WP-AppKit
Building a mobile app connected to WordPress with WP-AppKitBuilding a mobile app connected to WordPress with WP-AppKit
Building a mobile app connected to WordPress with WP-AppKit
 
Developing AR and VR Experiences with Unity
Developing AR and VR Experiences with UnityDeveloping AR and VR Experiences with Unity
Developing AR and VR Experiences with Unity
 
Android overview
Android overviewAndroid overview
Android overview
 
Q4
Q4Q4
Q4
 
Question 4 How did you use media technologies in the construction and researc...
Question 4 How did you use media technologies in the construction and researc...Question 4 How did you use media technologies in the construction and researc...
Question 4 How did you use media technologies in the construction and researc...
 
Perspective presentation
Perspective presentationPerspective presentation
Perspective presentation
 
How to Access and Use Gemini API for Free.pptx
How to Access and Use Gemini API for Free.pptxHow to Access and Use Gemini API for Free.pptx
How to Access and Use Gemini API for Free.pptx
 
Building VR Applications For Google Cardboard
Building VR Applications For Google CardboardBuilding VR Applications For Google Cardboard
Building VR Applications For Google Cardboard
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Evaluation Question 4
Evaluation Question 4 Evaluation Question 4
Evaluation Question 4
 
Android Development recipes with java.pptx
Android Development recipes with java.pptxAndroid Development recipes with java.pptx
Android Development recipes with java.pptx
 
Yaron Inger - Enlight - Inside the app of the year
 Yaron Inger - Enlight - Inside the app of the year  Yaron Inger - Enlight - Inside the app of the year
Yaron Inger - Enlight - Inside the app of the year
 
Evaluation - Question 1
Evaluation - Question 1Evaluation - Question 1
Evaluation - Question 1
 
Android Development Tutorial
Android Development TutorialAndroid Development Tutorial
Android Development Tutorial
 
Instant app Intro
Instant app IntroInstant app Intro
Instant app Intro
 

Kürzlich hochgeladen

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Kürzlich hochgeladen (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 

iOS 8 Action Extension Training

  • 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
  • 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