当我们点击iPhone上的主页按钮时,即当应用程序在后台运行时,调用的方法序列是什么。
基本上,我想在我的应用程序进入后台之前进行服务器调用。我正在applicationWillResignActive:
中编写我的服务器调用代码,但有时它会执行,有时则不执行。
我需要一个解决方案。
答案 0 :(得分:0)
从app委托文件本身:
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
Superclass implementation saves changes in the application's managed object context before the application terminates.
*/
[super applicationDidEnterBackground:application];
}
尝试使用这种方法.....