3

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.

Kevin
  • 1,147
  • 11
  • 21

7 Answers7

4

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.

8suhas
  • 1,460
  • 11
  • 20
  • 1
    This answer just saved my morning. I was facing a similar problem, with the iOS 5.1 simulator showing Default.png upon resuming, but testing on an actual 5.1 device didn't do that. +1. – JK Laiho Mar 15 '12 at 06:53
3

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.

Michał Dębski
  • 527
  • 4
  • 16
1

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.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • This may not help if his views take a long time to load. The Default.png will show up anyway if the view has been unloaded, even if the app is suspended. – Abizern Nov 27 '11 at 13:18
  • I don't think the Default.png gets re-displayed when the app comes back to the foreground, but instead a snapshot of what was on the screen when the app was put into the background. [There are a few questions on SO about snapshotting](http://stackoverflow.com/questions/6235112/preventing-snapshot-view-of-your-app-when-coming-back-from-multi-tasking). – Michael Dautermann Nov 27 '11 at 13:29
  • I have not add the UIApplicationExitsOnSuspend key – Kevin Nov 27 '11 at 13:40
1

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.

Mac_Cain13
  • 3,611
  • 2
  • 24
  • 38
  • I have not add the UIApplicationExitsOnSuspend key. And I don't think my app is exited, coz after my app foregrounded from background and after showing the Default.png, the status of my app is correct and everything is fine. – Kevin Nov 27 '11 at 13:29
1

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.

0

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

gugupluto
  • 31
  • 1
  • Please done't post the exact same answer to multiple questions: it's either not a good fit for all or the questions are duplicates which should be flagged/closed as such. – kleopatra Oct 14 '13 at 08:27
-1

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.

progrmr
  • 75,956
  • 16
  • 112
  • 147