2018-01-03 10:18:16.867028 0000 BareProject [1165:2053601]辞职有效
2018-01-03 10:18:17.510713 0000 BareProject [1165:2053601]有效
2018-01-03 10:18:17.634805 0000 BareProject [1165:2053601]辞职有效
这是有意的吗?我的代码在变为活动状态时做了很多工作,只是在120分钟后再次从地板中取出地毯,似乎文档说我应该使用applicationDidBecomeActive重新启动任务:
https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622956-applicationdidbecomeactive?language=objc
我在ios 10.3上试过这个并且这种行为不存在.
解决方法
“下拉”显示用于在iOS 9上正常工作的通知中心.只有applicationWillResignActive:用于系统调用,只需使用iOS 9 Simulator进行验证.
在iOS 11.2.6上,applicationDidBecomeActive:如你所描述的那样被调用,这看起来像是一个Apple bug.在这种特殊情况下,系统行为与文档冲突.这是另一个示例,其中文档偏离您观察到的行为https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StrategiesforHandlingAppStateTransitions/StrategiesforHandlingAppStateTransitions.html#//apple_ref/doc/uid/TP40007072-CH8-SW10
When your app is moved back to the active state,its applicationDidBecomeActive: method should reverse any of the steps taken in the applicationWillResignActive: method.