简体   繁体   中英

Handle local notification in background and suspended

I want to perform some task when local notification fired(assume application is in background/suspended but not in foreground) without taping user on notification. How it possible??. i am not able to get delegate in application:didReceiveLocalNotification: in case of application is in background/suspended and Local Notification fired. Please any one can suggest some solution. Thanks in advance.

The didReceiveLocalNotification method is only called when you application is running in the foreground. If you see a badge and click on the App to start it, then you need to process the local notification using application:willFinishLaunchingWithOptions: (or application:didFinishLaunchingWithOptions: ) To get at your local notification in either of these two methods, use UIApplicationLaunchOptionsLocalNotificationKey as a key to the options dictionary.

If your app is in suspended state, you won't be able to know that the notification is fired.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM