I have some network requests with 15s timeout in application:didFinishLaunchingWithOptions:
method. I found the following odd situation.
T1: app entered background by pressing home button
T2: app received silent push and executed didFinishLaunchingWithOptions:
method, then send requests
T3(> T2 + 15s): user taps app icon. All requests in T2 are timeout immediately.
My problem is why didFinishLaunchingWithOptions
was triggered in that situation and how to debug(reproduce this situation, because all above are in logs).
Silent push can launch suspended app (which has been properly killed by iOS system due to memory tight, not the user kill manually) to background. In this case, lifecycle of the app becomes:
application:willFinishLaunchingWithOptions:
application:didFinishLaunchingWithOptions:
applicationDidEnterBackground:
Apple document: About the Background Execution Sequence