我将我的应用程序的 UIWindow 子类化,然后当用户没有活动时,我使用 NSNotificationCenter 发出通知。我正在使用 [NSTimer scheduledTimerWithTimeInterval:target:selector: userInfo:repeats:]
我在我的 AppDelegate 类中处理这个问题。这可以正常工作,除非我使用 MBProgressHUD 运行代码 - http://iosdevelopertips.com/open-source/ios-open-source-heads-up-display-with-mbprogresshud.html 我认为这会启动另一个线程。当完成委托与响应通知的代码运行时同时触发时会发生错误。我很确定这是一个线程问题,但我该如何避免这种情况