这纯粹是出于开发目的,因为在您可以使用的设备上
-(void)applicationDidEnterBackground:(UIApplication *)application
但是我经常只是在 XCode 中点击停止按钮来停止模拟器的运行,我需要某种方法来运行,所以它可以告诉数据库当前玩家已经停止播放,知道该怎么做吗?
这纯粹是出于开发目的,因为在您可以使用的设备上
-(void)applicationDidEnterBackground:(UIApplication *)application
但是我经常只是在 XCode 中点击停止按钮来停止模拟器的运行,我需要某种方法来运行,所以它可以告诉数据库当前玩家已经停止播放,知道该怎么做吗?
I think this Apple Q&A will be interesting: Detecting the Debugger
I found it mid-way through this article:
Apple provided a little function to determine whether the debugger is attached here. So as soon as my application starts in the Simulator, I'll let it wait:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { #if DEBUG // Wait max. 10 secs for debugger to attach again: double waitTime = 0.0; while (AmIBeingDebugged() == NO && waitTime < 15.0) { [NSThread sleepForTimeInterval:0.25]; waitTime += 0.25; } #endif