Search code examples
iosios8-extension

Need help on Action Extensions iOS8


I need help on Action Extension, extension feature in iOS8. I am able to create a Action Extension target in my application and is able to see the extension in different Apps say Notes, Photos. Now, i am not able to call the appdelegate and other classes objects in the extension class.

So, how can i import Photos/notes and store it in my application?


Solution

  • You can't use the app delegate because it does not exist in an app extension. Extensions do not run as part of your app, they run independently of it. Moreover, [UIApplication sharedApplication] is specifically not available in app extensions, so the concept of an app delegate is not meaningful to app extensions.

    As for how you can import photos and/or notes, that really depends on how your app works. Action extensions can receive data from the host app (Notes or Photos, as you mention) but how you add it to your app depends on your app's design. You get the data via NSExtensionItems, and process it however you need to process it.