ios5 background management different from ios4?

折月煮酒 提交于 2019-12-23 19:11:20

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/8229392/ios5-background-management-different-from-ios4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!