Why iOS silent push triggers application:didFinishLaunchingWithOptions: when app is in background -
i have network requests 15s timeout in application:didfinishlaunchingwithoptions: method. found following odd situation.
t1: app entered background pressing home button
t2: app received silent push , executed didfinishlaunchingwithoptions: method, send requests
t3(> t2 + 15s): user taps app icon. requests in t2 timeout immediately.
my problem why didfinishlaunchingwithoptions triggered in situation , how debug(reproduce situation, because above in logs).
you can check app state determine whether app launched background when received notification:
- (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { if ( application.applicationstate == uiapplicationstateinactive || application.applicationstate == uiapplicationstatebackground ) { //opened push notification when app on background } } edit::
there's nothing debug here, intended functionality.
if want handle differently, can
uiapplicationlaunchoptionslocalnotificationkey
inside of launch options, , whatever work need when app launched notification.
Comments
Post a Comment