3

I need to make some url request when my application goes to background

I'm developing with the simulator and I've just noticed that when I press the power button to lock the screen the appDelegate method

- (void)applicationDidEnterBackground:(UIApplication *)application

with iOS 5 is automatically called, but this doesn't happen with iOS 4

is it right? can someone try if on real devices there's the same result?

is it possible to detect the power button pressure and differentiate the actions from the home button pressure?

thank You!

Gianluca
  • 2,379
  • 3
  • 25
  • 41

1 Answers1

2

Yes, this is correct.

Take a look at the "Adopting Multitasking in Your App" in Apple WWDC 2011 videos.

You can use beginBackgroundTaskWithExpirationHandler: to do your requests.

Léo Natan
  • 56,823
  • 9
  • 150
  • 195