0

On iOS, when the user press the hard button, it seems that the system makes a screenshot of the state of the app (to display it during the next launch of the app, in order to make the loading transparent for the user) and then it calls applicationDidEnterBackground of the UIApplicationDelegate to indicates the apps it went to the background state. Is that right ?

What I need to do is to know that the user pressed the hard button BEFORE the system takes a screenshot. Indeed I'd like to modify my view in case of going to the background state because I want to hide some stuff when the app launch again in the future.

It appears that the applicationDidEnterBackground is callled AFTER the screenshot is taken. Is there a way to be called BEFORE ?

Thanks

Vincent
  • 1,013
  • 14
  • 33

2 Answers2

1

- (void)applicationWillResignActive:(UIApplication *)application might run before the screenshot is taken. It is called before - (void)applicationDidEnterBackground:(UIApplication *)application. If it doesn't run before the screenshot, then I don't think you'll be able to change the data for the re-open screenshot without using Private APIs.

WhoaItsAFactorial
  • 3,538
  • 4
  • 28
  • 45
  • Thanks. I actually tried this (forgot to mention that on my post) and it seems that the screenshot is taken BEFORE applicationWillResignActive is sent or UIApplicationWillResignActiveNotification is posted. Is there a way to disable the screenshot things ? On the simulator each time the app is loaded the splashscreen is the default splashscreen of the app. Is it possible to get that on the device ? – Vincent Jul 23 '12 at 16:39
  • 1
    Only if you disable the app from saving a background state. You can do that by adding a bool to your plist `UIApplicationExitsOnSuspend = YES` – WhoaItsAFactorial Jul 23 '12 at 16:47
0

You can use the UIApplicationWillResignActiveNotification notification.

Nikolai Ruhe
  • 81,520
  • 17
  • 180
  • 200
  • Thanks. I actually tried this (forgot to mention that on my post) and it seems that the screenshot is taken BEFORE applicationWillResignActive is sent or UIApplicationWillResignActiveNotification is posted. Is there a way to disable the screenshot things ? On the simulator each time the app is loaded the splashscreen is the default splashscreen of the app. Is it possible to get that on the device ? – Vincent Jul 23 '12 at 16:39