I have properly set up my app for Remote Notifications with the method
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void)
and it processes it correctly now every time the app receives an Apple Push Notification.
But my issue is that this method is being called in all instances now.
didFinishLaunchingWithOptions does not seem to be called anymore? Or the launchOptions is coming up empty?
Basically I used the didReceiveRemoteNotification as a catch all to process any incoming notifications which is my intended purpose, but then when I click the notification itself, it fires the didReceiveRemoteNotification again. Thus processing the notification twice, which I do not want.
So this is how I want my app to handle notifications:
- Anytime a notification is received, would like to automatically process the notification in the background
- When user clicks notification from outside app, to run a different method than the
didReceiveRemoteNotification - When user is inside app, to run a different method than the other