ios - getting local notification while the app is in background -
while app in background didreceivelocalnotification not called.
so try notification didfinishlaunchingwithoptions
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions: (nsdictionary *)launchoptions { uilocalnotification *notification = [launchoptions objectforkey:uiapplicationlaunchoptionslocalnotificationkey]; //... }
but app background mode enable (using external accessory communication) when click on notification, didfinishlaunchingwithoptions not called.
any other way retrieve notification ?
by checking apple's document notifications, says:
ios note: in ios, can determine whether application launched result of user tapping action button or whether notification delivered already-running application examining application state. in delegate’s implementation of application:didreceiveremotenotification: or application:didreceivelocalnotification: method, value of applicationstate property , evaluate it. if value uiapplicationstateinactive, user tapped action button; if value uiapplicationstateactive, application frontmost when received notification.
as far know, when app in background-running state, , there comes local notification, won't receive method call, notification displayed user, if user tap notification , reactive app, receive -didreceivelocalnotification:
call.
Comments
Post a Comment