这纯粹是为了开发目的,因为在设备上你可以使用
-(void)applicationDidEnterBackground:(UIApplication *)application
但我经常只是点击 XCode 中的停止按钮来停止模拟器运行,我需要某种方法来运行,所以它可以告诉数据库当前玩家已经停止播放,知道该怎么做吗?
最佳答案
我认为这个 Apple 问答会很有趣:Detecting the Debugger
我在 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
https://stackoverflow.com/questions/17642703/
相关文章:
php - 无法使用多语言 codeigniter 摆脱 URL 中的默认 Controller
authentication - PuTTy 连接但 key 在使用 Plink 时被拒绝
wordpress - 寻求有关转义(斜杠)在 wpdb 中的工作原理和最佳实践的说明
scikit-learn - 在传递到 'roc_curve' 之前如何处理从 'auc' 返回的
spring - 如何为持久性 Quartz 作业重命名作业类?
ruby-on-rails - Rails - has_secure_password 密码和 PI