iPhone模拟器和applicationWillTerminate() [英] iPhone simulator and applicationWillTerminate()
问题描述
当我的应用程序在iPhone模拟器中运行时,委托方法
When my app is run in the iPhone simulator, the delegate method
- (void)applicationWillTerminate:(UIApplication *)application
仅在我第一次点击iPhone模拟器的主页按钮时调用。
is only called the first time I hit the iPhone simulator's home button.
按下主页按钮并再次启动应用程序后,点击主页按钮不会调用委托方法。
After the home button is pressed and the app is launched again, hitting the home button does not call the delegate method.
什么是在这里?我是否误解了一些基本的东西?
What is going on here? Am I misunderstanding something fundamental?
推荐答案
我怀疑它正在被调用,但你感到困惑,因为你击中了在模拟器中的主页按钮,你已经结束了Xcode中的当前会话。您的 applicationWillTerminate:
方法中可能有一个 NSLog
,是吗?点击Home按钮后, NSLog
s不再出现在Xcode的运行控制台中。如果你打开 /Applications/Console.app
我希望它们会出现在那里。
I suspect that it is being called, but that you are getting confused because after you hit the Home button in the Simulator, you've ended the current session in Xcode. You probably have an NSLog
in your applicationWillTerminate:
method, yes? Once you hit the Home button, NSLog
s no longer show up in Xcode's run console. If you open /Applications/Console.app
I expect they'll show up there.
这篇关于iPhone模拟器和applicationWillTerminate()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!