嘿,我在模擬器中嘗試多任務(我只有第二代iPod和iPad),我仍然有一些問題。我的測試方法是這樣的:applicationWillEnterForeground從來沒有叫
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSLog(@"Entering %s",__FUNCTION__);
if (enteredFromBackground) {
NSLog(@"Entering from Background");
enteredFromBackground = NO;
}
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
NSLog(@"Entering %s",__FUNCTION__);
enteredFromBackground = YES;
}
Unforntunately,我沒有看到從applicationWillEnterForeground的NSLog的,這就是爲什麼我添加了線來表示我applicationDidBecomeActive東西。 我得到的是
2010-11-20 15:58:12.796 iBeat[45997:207] Entering -[AppDelegate_Shared applicationDidEnterBackground:]
2010-11-20 15:58:18.160 iBeat[45997:207] Entering -[AppDelegate_Shared applicationDidBecomeActive:]
好吧,老實說,我讀了三遍,我認爲它還是它的方式是在WWDC教訓解釋。因此,在應用程序返回到前臺之前應調用「applicationWillEnterForeground」方法。我正在建立對4.1,我沒有選擇退出,我只是不明白什麼是錯的。我的意思是我得到了「applicationDidEnterBackground」,那爲什麼不當我回來呢? – Bersaelor 2010-11-26 01:05:32