EXC_CRASH when resuming iOS app - ios

I'm getting a rare crash in my iOS app when resuming from the background. I see -[NSObject doesNotRecognizeSelector:] in the exception backtrace but there is little more information. Any idea where I might start looking?
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x18f7291b8 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x18e16055c objc_exception_throw + 55
2 CoreFoundation 0x18f730268 -[NSObject+ 1274472 (NSObject) doesNotRecognizeSelector:] + 139
3 CoreFoundation 0x18f72d270 ___forwarding___ + 915
4 CoreFoundation 0x18f62680c _CF_forwarding_prep_0 + 91
5 CoreFoundation 0x18f6d6b5c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 23
6 CoreFoundation 0x18f6d6434 __CFRunLoopDoSources0 + 411
7 CoreFoundation 0x18f6d40a4 __CFRunLoopRun + 803
8 CoreFoundation 0x18f6022b8 CFRunLoopRunSpecific + 443
9 GraphicsServices 0x1910b6198 GSEventRunModal + 179
10 UIKit 0x1956427fc -[UIApplication _run] + 683
11 UIKit 0x19563d534 UIApplicationMain + 207
12 MyApp 0x100040d04 0x10003c000 + 19716
13 libdyld.dylib 0x18e5e55b8 start + 3
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018e6f7014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018e7bf450 pthread_kill + 112
2 libsystem_c.dylib 0x000000018e66b400 abort + 140
3 libc++abi.dylib 0x000000018e1352d4 __cxa_bad_cast + 0
4 libc++abi.dylib 0x000000018e152cc0 default_unexpected_handler+ 126144 () + 0
5 libobjc.A.dylib 0x000000018e160844 _objc_terminate+ 34884 () + 124
6 libc++abi.dylib 0x000000018e14f66c std::__terminate(void (*)+ 112236 ()) + 16
7 libc++abi.dylib 0x000000018e14f234 __cxa_rethrow + 144
8 libobjc.A.dylib 0x000000018e16071c objc_exception_rethrow + 44
9 CoreFoundation 0x000000018f60232c CFRunLoopRunSpecific + 560
10 GraphicsServices 0x00000001910b6198 GSEventRunModal + 180
11 UIKit 0x00000001956427fc -[UIApplication _run] + 684
12 UIKit 0x000000019563d534 UIApplicationMain + 208
13 MyApp 0x0000000100040d04 0x10003c000 + 19716
14 libdyld.dylib 0x000000018e5e55b8 start + 4

It seems that you are calling a method that dosen't belong to an object. It means your object on which you are calling a method is NSObject type and a method that you are calling is not availabel on NSObject. This used to happen when we are doing type casting.
For eg.
NSObject *obj = [NSObject new];
[(UIView *)obj setBackgroundColor:[UIColor whiteColor]]; // it will crash for unrecognize selector call
So the solution is to check the object using isKindOfClass: and then call a method thats belongs to it.

Related

Crash: When can shortValue return nil in iOS?

I am getting a crash in my class _PRLog.m in the method below -
#property (nonatomic, strong) NSNumber* logID;
- (int16_t)logIDValue
{
NSNumber *result = [self logID];
return [result shortValue]; // ---> ON THIS LINE
}
logID is being fetched from the Core Data which is saving attribute of type Integer-16.
I have the crashlog stated below -
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x18db28300 __exceptionPreprocess + 228 (NSException.m:199)
1 libobjc.A.dylib 0x18d83cc1c objc_exception_throw + 60 (objc-exception.mm:565)
2 CoreFoundation 0x18da26a90 -[NSObject(NSObject) doesNotRecognizeSelector:] + 144 (NSObject.m:144)
3 CoreFoundation 0x18db2ca60 ___forwarding___ + 1328 (NSForwarding.m:3520)
4 CoreFoundation 0x18db2ed60 _CF_forwarding_prep_0 + 96
5 DreamMapper 0x102bb0978 -[_PRLog logIDValue] + 48 (_PRLog.m:47)
6 DreamMapper 0x102c07aec -[PRDevice logForLogID:] + 188 (PRDevice.m:11)
7 DreamMapper 0x102be7c18 __48-[PRDeviceManager createDevice:success:failure:]_block_invoke_3 + 612 (PRDeviceManager.m:113)
8 libdispatch.dylib 0x18d7c6ec4 _dispatch_call_block_and_release + 32 (init.c:1408)
9 libdispatch.dylib 0x18d7c833c _dispatch_client_callout + 20 (object.m:495)
10 libdispatch.dylib 0x18d7d4600 _dispatch_main_queue_callback_4CF + 832 (inline_internal.h:2484)
11 CoreFoundation 0x18daa36b0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1749)
12 CoreFoundation 0x18da9e2c8 __CFRunLoopRun + 1708 (CFRunLoop.c:3069)
13 CoreFoundation 0x18da9d8f4 CFRunLoopRunSpecific + 480 (CFRunLoop.c:3192)
14 GraphicsServices 0x197eb4604 GSEventRunModal + 164 (GSEvent.c:2246)
15 UIKitCore 0x191c71358 UIApplicationMain + 1944 (UIApplication.m:4823)
16 DreamMapper 0x102c13690 main + 88 (main.m:8)
17 libdyld.dylib 0x18d9192dc start + 4
I am guessing based on this crash log that the code crashes only when it is unable to process the shortValue of result i.e. my saved logID. However, I tested the code by passing nil for result, and it still doesn't seem to crash. I takes 0 as the shortValue.
Can someone help me figure out what could be the probable cause of this crash?

How to interpret a iOS crash log and see the reason it crashed

Can anyone tell me what line to look at to see why my app crashed ? This is my first time experiencing a crash log and im kind of lost as in what direction to go in. Also if anyone is familiar with these could you tell me what are possible reasons this crash occured ?
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Last Exception Backtrace:
0 CoreFoundation 0x198217758 __exceptionPreprocess + 232
1 libobjc.A.dylib 0x19741fd00 objc_exception_throw + 59
2 CoreFoundation 0x1981306ac -[NSObject+ 222892 (NSObject) doesNotRecognizeSelector:] + 143
3 UIKitCore 0x1c5124aa8 -[UIResponder doesNotRecognizeSelector:] + 287
4 CoreFoundation 0x19821d0fc ___forwarding___ + 1411
5 CoreFoundation 0x19821eeb0 _CF_forwarding_prep_0 + 95
6 Foundation 0x198cb72f4 __NSFireTimer + 87
7 CoreFoundation 0x1981a7fb8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 31
8 CoreFoundation 0x1981a7ce4 __CFRunLoopDoTimer + 899
9 CoreFoundation 0x1981a74c8 __CFRunLoopDoTimers + 251
10 CoreFoundation 0x1981a2198 __CFRunLoopRun + 1811
11 CoreFoundation 0x1981a1764 CFRunLoopRunSpecific + 451
12 GraphicsServices 0x19a3dddd4 GSEventRunModal + 107
13 UIKitCore 0x1c50f800c UIApplicationMain + 215
14 Game 0x1041a116c 0x104120000 + 528748
15 libdyld.dylib 0x197c60ffc start + 3
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000197dac0bc __pthread_kill + 8
1 libsystem_c.dylib 0x0000000197d05250 __abort + 156
2 libsystem_c.dylib 0x0000000197d051b4 __abort + 0
3 libc++abi.dylib 0x0000000197407ff0 __cxa_bad_cast + 0
4 libc++abi.dylib 0x00000001974081b4 default_unexpected_handler+ 8628 () + 0
5 libobjc.A.dylib 0x0000000197420144 _objc_terminate+ 24900 () + 124
6 libc++abi.dylib 0x00000001974149d4 std::__terminate(void (*)+ 59860 ()) + 20
7 libc++abi.dylib 0x00000001974145cc __cxa_rethrow + 148
8 libobjc.A.dylib 0x000000019741fee0 objc_exception_rethrow + 48
9 CoreFoundation 0x00000001981a17d0 CFRunLoopRunSpecific + 560
10 GraphicsServices 0x000000019a3dddd4 GSEventRunModal + 108
11 UIKitCore 0x00000001c50f800c UIApplicationMain + 216
12 Game 0x00000001041a116c 0x104120000 + 528748
13 libdyld.dylib 0x0000000197c60ffc start + 4

Decipher iPhone crashlog

I got a crash for my own app on my iPhone, and am trying to figure out what happened. Here is the relevant part from the crash log in Xcode (sorry for the poor formatting):
Exception Type: EXC_CRASH (SIGABRT) Exception Codes:
0x0000000000000000, 0x0000000000000000 Exception Note:
EXC_CORPSE_NOTIFY Triggered by Thread: 0
Application Specific Information: abort() called
Filtered syslog: None found
Last Exception Backtrace: 0 CoreFoundation
0x1828c2d8c exceptionPreprocess + 228 1 libobjc.A.dylib
0x181a7c5ec objc_exception_throw + 55 2 CoreFoundation
0x1828d0098 -[NSObject+ 1388696 (NSObject) doesNotRecognizeSelector:]
+ 139 3 CoreFoundation 0x1828c85c8 ___forwarding_ + 1379 4 CoreFoundation 0x1827ae41c _CF_forwarding_prep_0 + 91 5 MyApp 0x102c33a0c 0x102bf0000 + 277004 6 MyApp
0x102c39d9c 0x102bf0000 + 302492 7 MyApp
0x102c1bed8 0x102bf0000 + 179928 8 MyApp
0x102c0754c 0x102bf0000 + 95564 9 libdispatch.dylib
0x1821b4aa0 _dispatch_call_block_and_release + 23 10
libdispatch.dylib 0x1821b4a60 _dispatch_client_callout +
15 11 libdispatch.dylib 0x1821f5bcc
_dispatch_main_queue_callback_4CF$VARIANT$armv81 + 527 12 CoreFoundation 0x18286b070
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 11 13 CoreFoundation 0x182868bc8 __CFRunLoopRun + 2271 14
CoreFoundation 0x182788da8 CFRunLoopRunSpecific + 551
15 GraphicsServices 0x18476e020 GSEventRunModal + 99 16
UIKit 0x18c7a8758 UIApplicationMain + 235 17
MyApp 0x102bf48f4 0x102bf0000 + 18676 18
libdyld.dylib 0x182219fc0 start + 3
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0
Crashed: 0 libsystem_kernel.dylib 0x00000001823492e0
pthread_kill + 8 1 libsystem_pthread.dylib 0x00000001824ee6a8 pthread_kill$VARIANT$armv81 + 360 2
libsystem_c.dylib 0x00000001822b7d0c abort + 140 3
libc++abi.dylib 0x0000000181a532c8 __cxa_bad_cast + 0 4
libc++abi.dylib 0x0000000181a53470
default_unexpected_handler+ 5232 () + 0 5 libobjc.A.dylib
0x0000000181a7c8d4 _objc_terminate+ 35028 () + 124 6
libc++abi.dylib 0x0000000181a6d37c
std::__terminate(void ()+ 111484 ()) + 16 7 libc++abi.dylib
0x0000000181a6cccc __cxxabiv1::exception_cleanup_func+ 109772
(_Unwind_Reason_Code, _Unwind_Exception) + 0 8 libobjc.A.dylib
0x0000000181a7c720 _objc_exception_destructor+ 34592 (void*) + 0 9
CoreFoundation 0x00000001828d0098
__methodDescriptionForSelector + 0 10 CoreFoundation 0x00000001828c85c8 ___forwarding_ + 1380 11 CoreFoundation
0x00000001827ae41c _CF_forwarding_prep_0 + 92 12 MyApp
0x0000000102c33a0c 0x102bf0000 + 277004 13 MyApp 0x0000000102c39d9c 0x102bf0000 + 302492 14 MyApp 0x0000000102c1bed8 0x102bf0000 + 179928 15 MyApp 0x0000000102c0754c 0x102bf0000 + 95564 16 libdispatch.dylib 0x00000001821b4aa0 _dispatch_call_block_and_release + 24 17
libdispatch.dylib 0x00000001821b4a60
_dispatch_client_callout + 16 18 libdispatch.dylib 0x00000001821f5bcc _dispatch_main_queue_callback_4CF$VARIANT$armv81 +
528 19 CoreFoundation 0x000000018286b070
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12 20 CoreFoundation 0x0000000182868bc8 __CFRunLoopRun +
2272 21 CoreFoundation 0x0000000182788da8
CFRunLoopRunSpecific + 552 22 GraphicsServices
0x000000018476e020 GSEventRunModal + 100 23 UIKit
0x000000018c7a8758 UIApplicationMain + 236 24 MyApp
0x0000000102bf48f4 0x102bf0000 + 18676 25 libdyld.dylib 0x0000000182219fc0 start + 4
So I do see some errors but they are all non-specific, not pointing to a specific call.
Can I extract more info from this log or somewhere else to figure out what could have gone wrong?

application crashes while opening notifications in ios

my application keep crashing when i try to open notifications by clicking on notification badge..i got the following crash report
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x24d33132 __exceptionPreprocess + 122
1 libobjc.A.dylib 0x32c8fc72 objc_exception_throw + 34
2 CoreFoundation 0x24d385f8 -[NSObject(NSObject) doesNotRecognizeSelector:] + 184
3 CoreFoundation 0x24d364d4 ___forwarding___ + 708
4 CoreFoundation 0x24c659d4 _CF_forwarding_prep_0 + 20
5 Skopic 0x000f7062 -[AppDelegate application:didReceiveRemoteNotification:] (AppDelegate.m:209)
6 UIKit 0x285d8c7c -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:] + 1836
7 UIKit 0x285d06a2 -[UIApplication workspace:didReceiveActions:] + 102
8 FrontBoardServices 0x2b7ccebc __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 12
9 CoreFoundation 0x24cf9250 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 8
10 CoreFoundation 0x24cf8514 __CFRunLoopDoBlocks + 212
11 CoreFoundation 0x24cf706e __CFRunLoopRun + 1710
12 CoreFoundation 0x24c4299c CFRunLoopRunSpecific + 472
13 CoreFoundation 0x24c427ae CFRunLoopRunInMode + 102
14 GraphicsServices 0x2c3f41a4 GSEventRunModal + 132
15 UIKit 0x283cd690 UIApplicationMain + 1436
16 Skopic 0x000f46fc main (main.m:15)
17 libdyld.dylib 0x33237aaa tlv_initializer + 2
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x332fddf0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x3337ec92 pthread_kill + 58
2 libsystem_c.dylib 0x3329c934 abort + 72
3 libc++abi.dylib 0x3249bbb8 abort_message + 84
4 libc++abi.dylib 0x324b566a default_terminate_handler() + 262
5 libobjc.A.dylib 0x32c8ff0e _objc_terminate() + 190
6 libc++abi.dylib 0x324b2dec std::__terminate(void (*)()) + 76
7 libc++abi.dylib 0x324b28b4 __cxa_rethrow + 96
8 libobjc.A.dylib 0x32c8fdba objc_exception_rethrow + 38
9 CoreFoundation 0x24c42a38 CFRunLoopRunSpecific + 628
10 CoreFoundation 0x24c427ae CFRunLoopRunInMode + 102
11 GraphicsServices 0x2c3f41a4 GSEventRunModal + 132
12 UIKit 0x283cd690 UIApplicationMain + 1436
13 Skopic 0x000f46fc main (main.m:15)
14 libdyld.dylib 0x33237aac start + 0
can someone explain why these crashes keep occurring?
I don't think it makes sense to turn the NSDictionary into another NSDictionary with [NSDictionary dictionaryWithDictionary:] ... also NSDictionary can be non-nil but contain 0 key entries (an empty dictionary).
Perhaps you want: NSDictionary *apnsPayload = [userInfo objectForKey: #"alert"]; ?
See:

Why class method appears twice in the call stack of the crash log, iOS

I got a crash log from an app that is already in App Store. The weird part of the crash log is that a class method appears twice in the backtrace of the crashed thread, as if the class method recursively called itself. I said weird because that class method is quite simple and it doesn't make a recursive call inside method body. Here is the part from the crash log:
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3b788350 __pthread_kill + 8
1 libsystem_c.dylib 0x3b6fefb2 pthread_kill + 54
2 libsystem_c.dylib 0x3b73b366 abort + 90
3 btg2 0x0172a358 ___lldb_unnamed_function128645$$btg2 + 280
4 btg2 0x0171af34 ___lldb_unnamed_function128478$$btg2 + 256
5 libsystem_c.dylib 0x3b708d38 _sigtramp + 40
6 btg2 0x0129fd7c +[PHAPIRequest expectedSignatureValueForResponse:nonce:secret:] (PHAPIRequest.m:129)
7 btg2 0x0129fd7c +[PHAPIRequest expectedSignatureValueForResponse:nonce:secret:] (PHAPIRequest.m:129)
8 btg2 0x012a1ee4 -[PHAPIRequest connectionDidFinishLoadingWithRequest:response:data:context:] (PHAPIRequest.m:501)
9 btg2 0x012aee04 -[PHConnectionManager connectionDidFinishLoading:] (PHConnectionManager.m:234)
10 Foundation 0x33d46912 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 14
11 Foundation 0x33c86764 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
12 Foundation 0x33c86680 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
13 CFNetwork 0x330e764c ___delegate_didFinishLoading_block_invoke_0 + 24
14 CFNetwork 0x330e6d30 ___withDelegateAsync_block_invoke_0 + 52
15 CFNetwork 0x3310f010 ___performAsync_block_invoke_068 + 16
16 CoreFoundation 0x33350aca CFArrayApplyFunction + 174
17 CFNetwork 0x3310f46e RunloopBlockContext::perform() + 70
18 CFNetwork 0x3307345e MultiplexerSource::perform() + 186
19 CoreFoundation 0x333df8f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
20 CoreFoundation 0x333df158 __CFRunLoopDoSources0 + 208
21 CoreFoundation 0x333ddf2a __CFRunLoopRun + 642
22 CoreFoundation 0x33351238 CFRunLoopRunSpecific + 352
23 CoreFoundation 0x333510c4 CFRunLoopRunInMode + 100
24 GraphicsServices 0x36f0c336 GSEventRunModal + 70
25 UIKit 0x3526d2b4 UIApplicationMain + 1116
26 btg2 0x0007da00 main (main.mm:21)
27 btg2 0x0007a504 ___lldb_unnamed_function1$$btg2 + 36
Does any one have a reasoning why +[PHAPIRequest expectedSignatureValueForResponse:nonce:secret:] appears twice in the backtrace or may be knows the reason of the crash? Appreciate your help!

Resources