Search code examples
iosiphonewidgetios8ios-app-extension

Access code and data in hosting app using today extension


I'm wondering if it's at all possible to access features in the main app using a today extension in iOS 8. For example, can a media player send commands from its extension to the main app without opening the app (I know there is a framework for this but it's just an example)? The only solution I can see is using URIs but the problem is that it will open the app which isn't the behavior I'm looking for.

So for a complete example using the media player:

  1. There is an extension in the today screen that allows you to play/pause using a button.

  2. The user presses the button and the app plays/pauses in the background without leaving the notification center.

Any way to achieve this behavior?


Solution

  • Code can be shared using an embedded framework, however there are some backwards compatibility issues.

    Data can be shared using shared user defaults.

    Both are explained in the apple docs.