Search code examples
objective-ciospush-notificationuiapplicationdelegate

iOS Push Notification/Framework issue


I've been checking around the net to find some information or source code to achieve this. The thing is, that the Application I am developing uses a custom framework we are also developing. And our customer wants to add Push Notification support for the App.

But he wants the Framework we created to handle the Push Notifications (rather than the App). The following graph will explain a bit better the situation:

enter image description here

The problem is that the AppDelegate seems to be the only handling the Notifications from the OS, so the only solution I can think of is the App forwarding the notifications that come from the OS to the Framework. Any ideas or thoughts? Am I missing something?

Txs in advance


Solution

  • You will have to forward the calls. It should only require a few lines of code added to the appdelegate to interface with your framework though.

    You could also do a hacky and more advanced approach where you swamp the IMP's of the AppDelegate methods and forward them through your framework. Just make sure you call the original imp once you're framework has done what it needs to. I wouldn't recommend this approach though as it may not remain stable for future ios versions.

    Forwarding the calls is the way to go in my opinion.