App goes into background spontaneously on launch leaving launch image showing

When I run my app from XCode debugger, it will occassionally freeze on the launch screen. Presssing home button has no effect. Double-press on home button will show the running apps as expected and fixes the problem: the launch image will be replaced with my UI in that background view and bringing it back to foreground works fine. Watching the log, I can see that my app responds to applicationWillResignActive shortly after launch, and goes into the background, as if user had pressed home button. I can't see anything the device log that would explain it, although I don't really know what to look for. Any suggestions? I wonder, is it an issue interacting with the XCode debugger, and possibly nothing to worry about for deployed app? I have seen this only on an iPad, running iOS 10.2. The iPad is new, but I also made a lot of recent changes to code, so not sure of the relation.

Replies

>I also made a lot of recent changes to code, so not sure of the relation.


In that case, be sure to _always_ Use Xcode's 'Product' menu with the option key pressed, then select 'Clean Build Folder' to force Xcode to acknowledge the latest change.