IOS Default.png show every time when my app enter

2020-04-08 12:40发布

问题:

I'm new to IOS development.

I set a Default.png file, and it is shown every time when the app enter foreground from background, but I just want Default.png is shown once when the app launch.

回答1:

I observed that whenever application is resumed from background, iOS 5.0 simulator showed the default image or launch image, whereas iOS 4.3 simulator showed the screenshot of the application, when it was entering background.



回答2:

For those seeking answer, it might be a case that your app didn't finish a task you set up to do when it enters background. It will finish it and resume, or if you will wait long enough in background the task will be completed and app will enter foreground as expected.



回答3:

Go to your Info.plist file in your project and look for this key:

UIApplicationExitsOnSuspend

make sure it is set to FALSE, or, in plist speak, <false/>

And here's a list of keys for UIKit on Apple's site, which includes the one I just referred you to.



回答4:

The Default.png is only used when your App is launched, not when your App is resumed and put into the foreground. The moments when your app is "foregrounded" iOS will use a screenshot it makes automatically when backgrounding your app as launch image.

If you see Default.png even when you multitask between your App and some other App there is something wrong. Maybe you opted out on the multitasking thing with the UIApplicationExitsOnSuspend key in your plist or your App is crashing when going to the background/using too much memory to be backgrounded.

If you debug your App in XCode it should give you some hints in the console about memory warnings and it's easy to see if your App is killed.



回答5:

Default.png is also visible in scenario when your app is waiting for a response and you enter back ground, in that case your delegates will also not get called, after you receive response the delegates are called and the default.png is removed.



回答6:

Kelvin: I have this problem too,now I had solve it.The reason is you did too much things in applicationDidEnterBackground ,try to decrease .



回答7:

Your app may have been terminated while it was in the background and is being started from the beginning. That would show the default screen again.