Hi All
my app randomly crash on very rare case. when bring app into foreground
I checked the code:
{
NSError *error = nil;
if (![sender authenticateWithPassword:MyManager.sharedManager.service.authToken.accessToken error:&error]) {
...
...
...
}
}
accessToken is NSString type, was that because accessToken is deallocated? Manager and service could not be nil at all.
Last Exception Backtrace:
0 CoreFoundation 0x18b04d2ec __exceptionPreprocess + 164
1 libobjc.A.dylib 0x1884d1a7c objc_exception_throw + 88
2 CoreFoundation 0x18b0b767c +[NSObject(NSObject) _copyDescription] + 0
3 CoreFoundation 0x18af64b84 ___forwarding___ + 1492
4 CoreFoundation 0x18af644f0 _CF_forwarding_prep_0 + 96
5 PTComms 0x102adafac __45-[XMPPStream authenticateWithPassword:error:]_block_invoke + 1884
6 libdispatch.dylib 0x192ecb584 _dispatch_client_callout + 16
7 libdispatch.dylib 0x192ec1b4c _dispatch_sync_invoke_and_complete_recurse + 64
8 libdispatch.dylib 0x192ec15dc _dispatch_sync_f_slow + 176
9 PTComms 0x102ada760 -[XMPPStream authenticateWithPassword:error:] + 516
10 PTComms 0x102a7b6f0 -[CommsService xmppStreamDidConnect:] + 160
11 CoreFoundation 0x18af64434 __invoking___ + 148
12 CoreFoundation 0x18af65044 -[NSInvocation invoke] + 424
13 CoreFoundation 0x18afbb6b8 -[NSInvocation invokeWithTarget:] + 64
14 PTComms 0x102b391c8 __42-[GCDMulticastDelegate forwardInvocation:]_block_invoke + 68
15 libdispatch.dylib 0x192eb1aac _dispatch_call_block_and_release + 32
16 libdispatch.dylib 0x192ecb584 _dispatch_client_callout + 16
17 libdispatch.dylib 0x192ee8574 _dispatch_main_queue_drain.cold.5 + 812
18 libdispatch.dylib 0x192ec0d30 _dispatch_main_queue_drain + 180
19 libdispatch.dylib 0x192ec0c6c _dispatch_main_queue_callback_4CF + 44
20 CoreFoundation 0x18afa62b4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
21 CoreFoundation 0x18afa40b0 __CFRunLoopRun + 1980
22 CoreFoundation 0x18afc8700 CFRunLoopRunSpecific + 572
23 GraphicsServices 0x1d7b09190 GSEventRunModal + 168
24 UIKitCore 0x18dbe6240 -[UIApplication _run] + 816
25 UIKitCore 0x18dbe4470 UIApplicationMain + 336
26 VoceraEdgeComms 0x102542318 0x10253c000 + 25368
27 dyld 0x1b19cbad8 start + 5964
Thread 0 name: Dispatch queue: xmpp
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x1dbb3a1dc __pthread_kill + 8
1 libsystem_pthread.dylib 0x2154b8b40 pthread_kill + 268
2 libsystem_c.dylib 0x192f6d360 __abort + 132
3 libsystem_c.dylib 0x192f6d2dc abort + 136
4 libc++abi.dylib 0x2153e25a0 abort_message + 132
5 libc++abi.dylib 0x2153d0f10 demangling_terminate_handler() + 344
6 libobjc.A.dylib 0x1884d3bb8 _objc_terminate() + 156
7 PTCore 0x1061f0d98 FIRCLSTerminateHandler() (.cold.3) + 56
8 PTCore 0x1060ef7e8 FIRCLSTerminateHandler() + 276
9 libc++abi.dylib 0x2153e18b4 std::__terminate(void (*)()) + 16
10 libc++abi.dylib 0x2153e4e1c __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 88
11 libc++abi.dylib 0x2153e4dc4 __cxa_throw + 92
12 libobjc.A.dylib 0x1884d1be4 objc_exception_throw + 448
13 CoreFoundation 0x18b0b767c -[NSObject(NSObject) doesNotRecognizeSelector:] + 364
14 CoreFoundation 0x18af64b84 ___forwarding___ + 1492
15 CoreFoundation 0x18af644f0 _CF_forwarding_prep_0 + 96
16 PTComms 0x102adafac __45-[XMPPStream authenticateWithPassword:error:]_block_invoke +
Thanks,
Frames 8 through 7 of thread 0 shows that you have a third-party crash reporter installed. I don’t trust the resulting crash reports, for the reasons I outline in Implementing Your Own Crash Reporter. I recommend that you remove it and then try to get an Apple crash report.
However, assuming that the crash report is to be believed, it’s most likely that sender
is a bogus object. Note frame 4, where the Objective-C method dispatcher is calling out to the forwarding infrastructure. This suggests that the target object doesn’t implement the method involved, and that usually suggests a memory management problem, where the actual sender
object has been deallocated and then some other object has been allocated in its place.
I recommend that you heavily exercise your app with zombies enabled. That might make the problem reproducible, and hence much easier to debug. See Standard Memory Debugging Tools.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"