崩潰報告細節:iOS7:後臺任務( 「MYAPP」 已經超出允許的時間積極斷言)
Hardware Model: iPhone5,2
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 3
Application Specific Information:
MyApp[1369] has active assertions beyond permitted time:
{(
<BKProcessAssertion: 0x175ca7d0> identifier: Called by MyApp, from -[AppDelegate applicationDidEnterBackground:] process: MyApp[1369] permittedBackgroundDuration: 180.000000 reason: finishTask owner pid:1369 preventSuspend preventIdleSleep preventSuspendOnSleep
)}
線3:
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x3937ea50 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3937e848 mach_msg + 36
2 CoreFoundation 0x2e61261c __CFRunLoopServiceMachPort + 152
3 CoreFoundation 0x2e610d3c __CFRunLoopRun + 788
4 CoreFoundation 0x2e57b7a4 CFRunLoopRunSpecific + 520
5 CoreFoundation 0x2e57b586 CFRunLoopRunInMode + 102
6 Foundation 0x2efbb23c +[NSURLConnection(Loader) _resourceLoadLoop:] + 316
7 Foundation 0x2f030a0a __NSThread__main__ + 1058
8 libsystem_pthread.dylib 0x393f8956 _pthread_body + 138
9 libsystem_pthread.dylib 0x393f88c6 _pthread_start + 98
10 libsystem_pthread.dylib 0x393f6ae4 thread_start + 4
使用後臺任務與「applicationDidEnterBackground這個代碼我的應用程序「:
// 10min background task
UIBackgroundTaskIdentifier myLongTask;
myLongTask = [[UIApplication sharedApplication]
beginBackgroundTaskWithExpirationHandler:^{
[locationMgrInstance timerSet];
}];
// cell change
[locationMgrInstance startMonitoringSignificantLocationChanges];
它適用於iOS 6 ...但是! 180秒後iOS 7拋出斷言。 幫助!
謝謝,但我仍然懷疑...當我使用該代碼(beginBackgroundTaskWithExpirationHandler),應用程序每分鐘調用直到10分鐘。 – jake85
但是你的代碼在哪裏調用了endBackgroundTask? – Paulw11
哦!我不是那種方法......這是否意味着我的情況? – jake85