iMessage AppDelegate without creating separate app?

I'm trying to use Local notifications in my iMessage extension, but there is no App Delegate for us to access the application property. Correct me if I'm wrong, but if I add an AppDelegate and blank ViewController to my iMessage app extension, won't I have to submit to the regular app store instead of the specialized Messages store? How do I access this functionality while keeping my app an extension?


Any replies are appreciated.

Accepted Reply

Technically speaking, every extension has a parent containing app. Even Sticker Pack Apps and iMessage Apps (as shown in Xcode's New Project panel) have an app that wraps the extension. You can see in the project settings pane there are two targets in the list. One is the extension itself, and the other is the app that contains it. When you submit to iTunes Connect, you're always submitting a .ipa, and that .ipa always contains an app, and inside the app is your extension. The twist here is that the parent app is not shown on the user's home screen.


So now to your question. UIApplication objects live in the parent iOS app. For standalone iMessage Apps, there's no code in the parent iOS app, which means for these types of apps (either sticker packs or standalone iMessage apps) you cannot do what you want. If you want to use UIApplication methods, then you have to have a real parent iOS app. It would exist on the user's home screen. So yes, you are correct, and you would have to make a "regular" app that would have to be submitted to the main App Store.

Replies

Technically speaking, every extension has a parent containing app. Even Sticker Pack Apps and iMessage Apps (as shown in Xcode's New Project panel) have an app that wraps the extension. You can see in the project settings pane there are two targets in the list. One is the extension itself, and the other is the app that contains it. When you submit to iTunes Connect, you're always submitting a .ipa, and that .ipa always contains an app, and inside the app is your extension. The twist here is that the parent app is not shown on the user's home screen.


So now to your question. UIApplication objects live in the parent iOS app. For standalone iMessage Apps, there's no code in the parent iOS app, which means for these types of apps (either sticker packs or standalone iMessage apps) you cannot do what you want. If you want to use UIApplication methods, then you have to have a real parent iOS app. It would exist on the user's home screen. So yes, you are correct, and you would have to make a "regular" app that would have to be submitted to the main App Store.

Thanks for the clarification.


One more question: if we build an app and submit to the store that just includes a message extension (and so doesn't appear on the home screen), would we be able to add a 'stand-alone' app in a subsequent update? Would the app's icon then just appear on the user's home screen?

No. If you want to make that change you'd have to remove the standalone app and then create a different "real" app. These would be two different apps, and your ratings, charts, etc would not carry over. If that's where you are ultimately heading, it would be best to start off in that state.

That's dissapointing to hear. Thanks you for the response!