Reputation: 1003
I am receiving a remote push notification, and i need to register a UILocalNotification, within 30 minutes, but i need to do it even if the user do not click in the notification, in the background.
There's any way to do it, like in :
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
}
It works fine here, but only if the user clicks in the notification, or if the app is currently running.
Upvotes: 0
Views: 463
Reputation: 138
You need to turn on "background fetch" in the "capabilities" section of your project settings, and use the application:didReceiveRemoteNotification:fetchCompletionHandler
delegate method in your ApplicationDelegate
file. This way you can handle remote notifications in the background. Don't forget to set the content-available flag in your aps
dictionary when sending the push.
Upvotes: 0
Reputation: 3606
You can't handle a remote notification if the application is not running until the user doesn't launch your app. You should deal with the business logic on server-side. Keep track of when the notifications are sent and trigger the appropriate action after the time frame are exceeded.
Upvotes: 2