Objective c 由于超出允许时间的活动断言而导致应用程序崩溃

Objective c 由于超出允许时间的活动断言而导致应用程序崩溃,objective-c,ios,cocoa-touch,nsurlconnection,core-location,Objective C,Ios,Cocoa Touch,Nsurlconnection,Core Location,事故报告详细内容如下: Exception Type: 00000020 Exception Codes: 0x8badf00d Highlighted Thread: 3 Application Specific Information: MyApp[123] has active assertions beyond permitted time: {( <SBProcessAssertion: 0x4b52f0> identifier: CoreLocationB

事故报告详细内容如下:

Exception Type:  00000020
Exception Codes: 0x8badf00d
Highlighted Thread:  3

Application Specific Information:
MyApp[123] has active assertions beyond permitted time: 
{(
    <SBProcessAssertion: 0x4b52f0> identifier: CoreLocationBackgroundClient process: MyApp[579] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:123 preventSuspend  preventIdleSleep 
)}

Elapsed total CPU time (seconds): 13.980 (user 13.980, system 0.000), 1% CPU 
Elapsed application CPU time (seconds): 0.251, 0% CPU

该应用程序使用GPS。知道为什么会发生这种崩溃吗?

看起来您使用了错误的后台处理方式。600秒的时间是最重要的。这表明您使用的是任务完成API,它为应用程序提供了有限的时间(目前为十分钟)来完成某些活动,然后将其挂起


如果您想在后台继续监控GPS位置,则需要使用特定的核心位置API(并在Info.plist中设置相应的标志)。

可能重复@rishi。这是我第一次面对这个问题。你可以查看我以前的问题。我刚才给出的问题链接与你的问题链接完全相同,我希望这能帮助你解决这个问题。没有痛苦的感觉!!!!哦对不起。我可以看出同步连接是个问题。当GPS打开时,我的应用程序工作正常。但是如果GPS关闭,那么它就会崩溃。这仅仅意味着当你获取数据时,一切都很好,一旦数据停止,就会出现问题,你需要检查代码中的数据处理。对此不太确定。嗨,我已经在使用所需的后台模式作为定位服务(GPS)进行后台处理。当应用程序处于后台时,任务工作正常。我突然遇到了这样的崩溃,我关掉了我的GPS应用程序,试着做一些任务。我猜NSURLConnectionHi中有一些问题,我在后台使用NStimer并发送http请求并处理它,但它认为这个错误你能帮助我吗?@JigneshB听起来像是一个新问题。位置服务是iOS上的一个特例。NSTimer的工作时间不会超过十分钟,因此您需要执行后台提取之类的操作。
Thread 3 name:  com.apple.NSURLConnectionLoader
Thread 3:
0   libsystem_kernel.dylib          0x30e67004 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x30e671fa mach_msg + 50
2   CoreFoundation                  0x381ea3ec __CFRunLoopServiceMachPort + 120
3   CoreFoundation                  0x381e9124 __CFRunLoopRun + 876
4   CoreFoundation                  0x3816c49e CFRunLoopRunSpecific + 294
5   CoreFoundation                  0x3816c366 CFRunLoopRunInMode + 98
6   Foundation                      0x373a7bb2 +[NSURLConnection(Loader) _resourceLoadLoop:] + 302
7   Foundation                      0x373a7a7a -[NSThread main] + 66
8   Foundation                      0x3743b58a __NSThread__main__ + 1042
9   libsystem_c.dylib               0x333c972e _pthread_start + 314
10  libsystem_c.dylib               0x333c95e8 thread_start + 0