Handle notifications with app killed IOS

right now I'm developing an app capable of receiving notifications, and it was going fine, until I stepped on the need of having to send to my server a copy of the notification received on the app.

Although I know the downsides to this approach, it's the only way that I can process the notifications received.

Right now I can handle the notifications that are received with the app on background and foreground through this method

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler  

. Inside this method I call the NSURLConnection sendAsynchronousRequest to send to my server the notification data received.

But when the app is killed (eliminated from the the background apps), I no longer can process the notification through this method.

Is there a method that I can call when the app is killed that allows me to make a post request to my server after I receive the notification?

1 answer

  • answered 2017-10-11 10:38 Kashif Mujeeb

    I think there is no way to do this until and unless you open the App...