Unrecognized selector sent to instance - Application crashes only on Release - ios

NOTE This is more of an iOS troubleshooting question not a React Native one. So even if you're an iOS dev and not specifically into React Native, please please read further. Your help will be greatly appreciated :)
I am building a React Native app with the Agora SDK using the react native wrapper from https://github.com/syanbo/react-native-agora
I have a weird issue when launching a new Video call, I get the following error:
2019-01-23 16:20:18.512762+0530 PwcApp[786:355367] Exception '-[AgoraRtcEngineKit setClientRole:withKey:]: unrecognized selector sent to instance 0x1072a7b80' was thrown while invoking init on target Agora with params (
{
appid = c617eddc6ceb4782adb509aa91b17580;
channelProfile = 1;
clientRole = 1;
swapWidthAndHeight = 1;
videoProfile = 40;
}
)
callstack: (
0 CoreFoundation 0x00000001beb37f10 <redacted> + 252
1 libobjc.A.dylib 0x00000001bdd05a40 objc_exception_throw + 56
2 CoreFoundation 0x00000001bea4f154 <redacted> + 0
3 CoreFoundation 0x00000001beb3d810 <redacted> + 1412
4 CoreFoundation 0x00000001beb3f4bc _CF_forwarding_prep_0 + 92
5 PwcApp 0x00000001055f48f4 -[RCTAgora init:] + 1200
6 CoreFoundation 0x00000001beb3f660 <redacted> + 144
7 CoreFoundation 0x00000001bea1b980 <redacted> + 292
8 CoreFoundation 0x00000001bea1c564 <redacted> + 60
9 PwcApp 0x00000001048fa30c -[RCTModuleMethod invokeWithBridge:module:arguments:] + 492
10 PwcApp 0x000000010493fa60 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 248
11 PwcApp 0x000000010493f7bc ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 88
12 libdispatch.dylib 0x0000000106e87840 _dispatch_call_block_and_release + 24
13 libdispatch.dylib 0x0000000106e88de4 _dispatch_client_callout + 16
14 libdispatch.dylib 0x0000000106e96a94 _dispatch_main_queue_callback_4CF + 1360
15 CoreFoundation 0x00000001beac61bc <redacted> + 12
16 CoreFoundation 0x00000001beac1084 <redacted> + 1964
17 CoreFoundation 0x00000001beac05b8 CFRunLoopRunSpecific + 436
18 GraphicsServices 0x00000001c0d34584 GSEventRunModal + 100
19 UIKitCore 0x00000001eb507558 UIApplicationMain + 212
20 PwcApp 0x0000000104787240 main + 124
21 libdyld.dylib 0x00000001be580b94 <redacted> + 4
)
This error happens only on a Release build. Debug runs completely fine. From all that I could gather this far I figured that there are a couple common culprits to this. Essentially I tried to eliminate as much difference between Release and Debug as possible. What I have tried so far:
Set Strip debug symbols on copy to NO on Release (set it same as debug).
Set Dead code stripping to NO on Release (set it same as debug).
Set Build Active Architecture only to NO on Release (set it same as debug).
Set Optimization level to NONE [-O0] (set it same as debug).
None of the above seems to solve the problem. So my question mostly now is how do I proceed in terms of troubleshooting? Is there any other setting that differs between the Debug/Release build that I could try?

Related

App crashes immediately on iOS Simulator with os version 15 and up

I'm trying to run an app on iOS simulator with os version of 15.2 the app crashes immediately. I also trying running on a Simulator with os version of 13.7 and everything works. I would also like to point out that testing on a real device with os 15.0.1 works fine it's only the simulators with os of 15 and above are the problematic once. (I didn't try it on os 14 though).
The exception that I see is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL URLByAppendingPathExtension:]: component, components, or pathExtension cannot be nil.'
I also see in the logs the following error
2022-01-23 22:17:56.420470+0200 ********[99005:556023] [Assert] failed to get type for URL (file:///Users/**********/Library/Developer/CoreSimulator/Devices/70A52D90-4707-4CF8-9804-D2F030583E8D/data/Containers/Data/Application/97394EA4-CEB7-45FC-B624-41389A934FC0/Library/MyDocument.md) error: The file “MyDocument.md” couldn’t be opened because there is no such file.
What is that MyDocument.md that it's looking for?
Here's the callstack as well:
0 CoreFoundation 0x000000010b5f6ba4 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00000001097f4be7 objc_exception_throw + 48
2 Foundation 0x00000001092a2fe8 -[NSURL(NSURLPathUtilities) URLByDeletingPathExtension] + 0
3 UIKitCore 0x000000011ae3d46b -[UIDocument saveToURL:forSaveOperation:completionHandler:] + 270
4 FLOTelematicsSDK 0x0000000109fb4b75 _Z35FLOEncryption_streamBlockEnryptDataP20FLOEncryptionContext17Uint32PointerData + 11764
5 FLOTelematicsSDK 0x0000000109fb65e1 _Z35FLOEncryption_streamBlockEnryptDataP20FLOEncryptionContext17Uint32PointerData + 18528
6 libdispatch.dylib 0x0000000109a0565a _dispatch_call_block_and_release + 12
7 libdispatch.dylib 0x0000000109a0683a _dispatch_client_callout + 8
8 libdispatch.dylib 0x0000000109a13c88 _dispatch_main_queue_callback_4CF + 1075
9 CoreFoundation 0x000000010b56484d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
10 CoreFoundation 0x000000010b55f0aa __CFRunLoopRun + 2772
11 CoreFoundation 0x000000010b55e0f3 CFRunLoopRunSpecific + 567
12 GraphicsServices 0x000000010ed0dcd3 GSEventRunModal + 139
13 UIKitCore 0x000000011b548f42 -[UIApplication _run] + 928
14 UIKitCore 0x000000011b54db5e UIApplicationMain + 101
15 SDKSandbox 0x000000010081b60b main + 80
16 dyld 0x0000000108fadee9 start_sim + 10
17 ??? 0x0000000200ad34fe 0x0 + 8601285886
18 ??? 0x0000000200ace000 0x0 + 8601264128
)
Has anyone faced something like that?
Side notes:
My app uses a third-party SDK, could it be that the SDK is faulty?
xCode version is 13.2.1
As pointed out by matt in the comment, the problem was indeed with the SDK.

What does it mean by DiskCookies Crash on iOS App?

I use Fabric to log crash on my iOS App.
Today, I came across some crash related to DiskCookies. I really don't know what it means.
Crashed: diskcookies
0 CoreFoundation 0x1bd00136 CFNotificationCenterPostNotification + 53
1 libsystem_malloc.dylib 0x1b5d9cf3 szone_malloc_should_clear + 3240
2 CFNetwork 0x1c44a359 DiskCookieStorage::writeFileCompletely0(DiskCookieStorage*, FilePathStat*, MemoryCookies const*, __CFData const*, TracerData*, int) + 634
3 CFNetwork 0x1c44a49d DiskCookieStorage::_asyncWriteFileCompletely(void*) + 174
4 libdispatch.dylib 0x1b4a1783 _dispatch_client_callout + 22
5 libdispatch.dylib 0x1b4ada35 _dispatch_barrier_sync_f_invoke + 50
6 CFNetwork 0x1c44b09d DiskCookieStorage::syncStorageWithCompletionLocked(unsigned char, void () block_pointer) + 2220
7 CFNetwork 0x1c44277b ___CFHTTPCookieStorageFlushCookieStores_block_invoke + 86
8 CoreFoundation 0x1bcf5447 __CFDictionaryApplyFunction_block_invoke + 20
9 CoreFoundation 0x1bce0634 CFBasicHashApply + 120
10 CoreFoundation 0x1bce94c1 CFDictionaryApplyFunction + 152
11 CFNetwork 0x1c44270f _CFHTTPCookieStorageFlushCookieStores + 140
12 libsystem_c.dylib 0x1b53720d __cxa_finalize_ranges + 290
13 libsystem_c.dylib 0x1b4f61b3 exit + 12
14 Comico 0x97a74f UnityGetGLViewController + 4756906
15 Comico 0x97a265 UnityGetGLViewController + 4755648
16 Comico 0x980a6b UnityGetGLViewController + 4782278
17 Comico 0x96dfb5 UnityGetGLViewController + 4705808
18 Comico 0x96da59 UnityGetGLViewController + 4704436
19 Comico 0x200fe3 -[AppDelegate setUpAppGuardWithUserID:] (AppDelegate.m:1303)
20 Comico 0x1ff967 __36-[AppDelegate dologinInCallLoginAPI]_block_invoke (AppDelegate.m:1026)
21 Comico 0x13f69b __42-[NCLoginRAPIManager loginWithCompletion:]_block_invoke (NCLoginRAPIManager.m:97)
22 Comico 0xde19f -[NCRAPICompletion performBlockWithOperation:] (NCRAPICompletion.m:94)
23 CoreFoundation 0x1bd06323 -[NSArray makeObjectsPerformSelector:withObject:] + 218
24 Comico 0x3adf0d -[NCRAPIOperationRegister performCompletionBlockOfOperation:] (NCRAPIOperationRegister.m:67)
25 Comico 0x251ce1 __51-[NCRAPIManager callRAPIWithAPIRequest:completion:]_block_invoke_2 (NCRAPIManager.m:65)
26 libdispatch.dylib 0x1b4a1797 _dispatch_call_block_and_release + 10
27 libdispatch.dylib 0x1b4a1783 _dispatch_client_callout + 22
28 libdispatch.dylib 0x1b4a5d05 _dispatch_main_queue_callback_4CF + 902
29 CoreFoundation 0x1bd8fd69 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
30 CoreFoundation 0x1bd8de19 __CFRunLoopRun + 848
31 CoreFoundation 0x1bce11af CFRunLoopRunSpecific + 470
32 CoreFoundation 0x1bce0fd1 CFRunLoopRunInMode + 104
33 GraphicsServices 0x1d48bb41 GSEventRunModal + 80
34 UIKit 0x21069a53 UIApplicationMain + 150
35 Comico 0x20dc39 main (main.m:19)
36 libdyld.dylib 0x1b4ce4eb start + 2
I believe someone is trying to modify the path where network library put data to. Does anyone have any other theory or have some experience on this crash?
From the stack trace you posted here is my theory.
Frame 14 indicates that you've got a Unity application, and it's doing its thing running OpenGL.
Frame 13 is really interesting. It seems like the Unity UnityGetGLViewController (which I assume is not written by you) has called exit. This is surprising behavior, but it gives lots of clues on the rest of the stack.
Frames 12-2 look like the network stack is just doing some work on application exit (triggered by UnityGetGLViewController). Seems like it is just writing some cookie-related stuff to disk. I wouldn't worry about this.
Frame 0 and 1 are really suspect. I have a very hard time believing that malloc calls into CoreFoundation. If I had to guess, I would say that frame 0 is correct, and frame 1 has been mis-symbolicated or incorrectly unwound.
It's very unusual to call exit in iOS applications. While it is technically API, I doubt it is heavily tested. My bet is that there are some dangling pointer and/or object lifecycle issues related to the use of exit and you are seeing it here.
What I would do is see if Unity has any documentation around UnityGetGLViewController calling exit. I'd also check in with the Fabric people about frames 1 and 0. I don't see how both could be correct. And, finally, I might consider opening a bug with Apple. However, Apple usually doesn't like looking at non-Apple crash reports. So, that last one is probably a long-shot.

In iPad pro 11.2.5 App get crashed

In my app, I have used one textfield. When tap on textfield the device keyboard will appear and than I type some text in that textfield. On that time the app get crashed in iPad Pro 11.2.5 version. I don't know why the app getting crashed because the same code works perfect in iPad Pro 10.3 version. Please review the my crash analytics report below
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x184410430 objc_msgSend + 16
1 CoreFoundation 0x18514513c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
2 CoreFoundation 0x1851446dc _CFXRegistrationPost + 420
3 CoreFoundation 0x185144440 ___CFXNotificationPost_block_invoke + 60
4 CoreFoundation 0x1851c1e24 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1408
5 CoreFoundation 0x18507ad60 _CFXNotificationPost + 380
6 Foundation 0x185aa7348 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
7 UIFoundation 0x18f8c4570 -[NSTextStorage processEditing] + 240
8 UIFoundation 0x18f8c41d8 -[NSTextStorage endEditing] + 92
9 UIKit 0x18e914368 -[UITextInputController _insertText:fromKeyboard:] + 488
10 UIKit 0x18e9136d0 -[UITextInputController insertText:] + 400
11 UIKit 0x18ead3518 -[UIFieldEditor insertFilteredText:] + 968
12 UIKit 0x18f3eb3a0 -[UITextField insertFilteredText:] + 104
13 UIKit 0x18e91343c -[UIKeyboardImpl insertText:] + 136
14 UIKit 0x18ebd735c -[UIKeyboardImpl performKeyboardOutput:] + 756
15 UIKit 0x18ebd665c __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2 + 256
16 UIKit 0x18f431fac -[UIKeyboardTaskEntry execute:] + 192
17 UIKit 0x18e7975f0 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 384
18 Foundation 0x185baf2e4 __NSThreadPerformPerform + 340
19 CoreFoundation 0x18515b77c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
20 CoreFoundation 0x18515b6fc __CFRunLoopDoSource0 + 88
21 CoreFoundation 0x18515af84 __CFRunLoopDoSources0 + 204
22 CoreFoundation 0x185158b5c __CFRunLoopRun + 1048
23 CoreFoundation 0x185078c58 CFRunLoopRunSpecific + 436
24 GraphicsServices 0x186f24f84 GSEventRunModal + 100
25 UIKit 0x18e7d15c4 UIApplicationMain + 236
26 Q App 0x1050b756c main (main.m:16)
27 libdyld.dylib 0x184b9856c start + 4
As my crash reports, I didn't use NotificationCenter/observer in that screen. But the crash reports are showing in the NotificationCenter. Please Any know the solution for this ?
Note: The following is without knowing all required details because you did not provide any source code on how you implemented the feature nor does the crash report shown here contain any information about the exception code/signal being thrown.
The top frame shows the method objc_msgSend being invoked. This method is always used when the runtime tries to send a message (method) to an object. And crashes in this method usually mean the object doesn't exist any longer which means it was deallocated but your code still holds a reference.
So this looks like a memory management issue in your code. Without your actual implementation it is impossible to provide any meaningful help.
The best way to debug this is to run the app in debug mode and the device attached to Xcode and get more details. The Instrument tools can also help finding out where the problem is.

Abnormal main.m crash

In my iOS app, I keep getting crash reports like this one.
0 libsystem_kernel.dylib 0x000000018d805014 __pthread_kill + 4
1 libsystem_c.dylib 0x000000018d7799c4 abort + 136
2 libc++abi.dylib 0x000000018d2451b0 abort_message + 128
3 libc++abi.dylib 0x000000018d25ec04 default_terminate_handler() + 300
4 libobjc.A.dylib 0x000000018d26c820 objc_terminate() + 120
5 libc++abi.dylib 0x000000018d25b5d4 std::__terminate() + 12
6 libc++abi.dylib 0x000000018d25b640 std::terminate() + 56
7 libdispatch.dylib 0x000000018d6c29b4 _dispatch_client_callout + 32
8 libdispatch.dylib 0x000000018d6c75e8 _dispatch_main_queue_callback_4CF + 992
9 CoreFoundation 0x000000018e7b90c0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x000000018e7b6cdc __CFRunLoopRun + 1568
11 CoreFoundation 0x000000018e6e6d94 CFRunLoopRunSpecific + 420
12 GraphicsServices 0x0000000190150074 GSEventRunModal + 96
13 UIKit 0x000000019499f44c UIApplicationMain + 204
! 14 MyAppNameHere 0x000000010007b090 main (main.m:33)
15 libdyld.dylib 0x000000018d6f559c start + 0
The strange thing is that none of this exists within my code except for the main.m. All other threads in my application don't have anything related to either. This crash appears to only happen for a fraction of a percent of my users, so I am not sure where to even start looking.
The question as it is formulated right now is not answerable, because it is missing necessary information. See e.g. this tutorial for an explanation of how to obtain a real backtrace and how to obtain a "crash reason". Without following the recommended steps for debugging crashes every crash of an iOS-app looks exactly the same as the crash you just provided.
In order to get a real/useful backtrace, you need to set an exception breakpoint in Xcode.

ios 8 + LiveSDK authentication crashes my app

I have an app in the store that use LiveSDK API to log the user into OneDrive. The last release was pushed before iOS8 came out, but it works without problem with iOS8
Now I want to push an update (unrelated to OneDrive features) and I am using xcode 6.1.1 but testing the app I noticed that every time the user is authenticated into OneDrive the app will crash as soon as return from a segue or flipside view to the Main View.
I was able to isolate the issue to this line added in viewDidLoad:
self.liveClient = [[LiveConnectClient alloc] initWithClientId:APP_CLIENT_ID
delegate:self
userState:#"initialize"];
and I really followed the basic instructions on how to login that can be found here:
http://msdn.microsoft.com/en-us/library/dn631822.aspx#sign_the_user_in
The steps to reproduce the issue (on both thee device and the simulator) are the following:
a) app starts
b) click to the cloud service login button that will trigger a flipsideviewcontroller
c) log into OneDrive with the code provided by MS
d) go back to the main controller
e) CRASH!
The trace is the following:
#########################################################
*** First throw call stack:
(
0 CoreFoundation 0x028dd1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x026598e5 objc_exception_throw + 44
2 CoreFoundation 0x0297a243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x028cd50b ___forwarding___ + 1019
4 CoreFoundation 0x028cd0ee _CF_forwarding_prep_0 + 14
5 CloudFella 0x0015c867 -[LiveConnectClientCore dealloc] + 48
6 libobjc.A.dylib 0x0266a692 _ZN11objc_object17sidetable_releaseEb + 268
7 libobjc.A.dylib 0x0266baeb -[NSObject release] + 25
8 CloudFella 0x00158af1 -[LiveConnectClient dealloc] + 44
9 libobjc.A.dylib 0x0266a692 _ZN11objc_object17sidetable_releaseEb + 268
10 libobjc.A.dylib 0x02669e81 objc_release + 49
11 libobjc.A.dylib 0x02669e3e objc_storeStrong + 39
12 CloudFella 0x00157b9d -[CFFlipsideViewController .cxx_destruct] + 249
13 libobjc.A.dylib 0x026582d4 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 128
14 libobjc.A.dylib 0x0265824f object_cxxDestruct + 20
15 libobjc.A.dylib 0x0266327a objc_destructInstance + 48
16 libobjc.A.dylib 0x026632ab object_dispose + 20
17 UIKit 0x01433d1a -[UIViewController dealloc] + 1854
18 UIKit 0x01430915 -[UIViewController release] + 89
19 libobjc.A.dylib 0x02669e97 objc_release + 71
20 libobjc.A.dylib 0x02656bf0 objc_setProperty_nonatomic + 48
21 UIKit 0x01a6167d -[_UIViewControllerOneToOneTransitionContext _setFromViewController:] + 47
22 UIKit 0x01a61490 -[_UIViewControllerOneToOneTransitionContext dealloc] + 43
23 libobjc.A.dylib 0x0266a692 _ZN11objc_object17sidetable_releaseEb + 268
24 libobjc.A.dylib 0x0266baeb -[NSObject release] + 25
25 UIKit 0x01a60834 -[_UIViewControllerTransitionContext completeTransition:] + 135
26 UIKit 0x01a7a5b1 -[UIViewControllerBuiltinTransitionViewAnimator transitionViewDidComplete:fromView:toView:removeFromView:] + 50
27 UIKit 0x01416137 -[UITransitionView notifyDidCompleteTransition:] + 345
28 UIKit 0x01415e61 -[UITransitionView _didCompleteTransition:] + 1333
29 UIKit 0x014181b7 -[UITransitionView _transitionDidStop:finished:] + 107
30 UIKit 0x013666dc -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 267
31 UIKit 0x013669c8 -[UIViewAnimationState animationDidStop:finished:] + 80
32 QuartzCore 0x00fd6bb4 _ZN2CA5Layer23run_animation_callbacksEPv + 304
33 libdispatch.dylib 0x0326b4d0 _dispatch_client_callout + 14
34 libdispatch.dylib 0x03259726 _dispatch_main_queue_callback_4CF + 340
35 CoreFoundation 0x0294243e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
36 CoreFoundation 0x028835cb __CFRunLoopRun + 1963
37 CoreFoundation 0x028829d3 CFRunLoopRunSpecific + 467
38 CoreFoundation 0x028827eb CFRunLoopRunInMode + 123
39 GraphicsServices 0x0301f5ee GSEventRunModal + 192
40 GraphicsServices 0x0301f42b GSEventRun + 104
41 UIKit 0x01316f9b UIApplicationMain + 1225
42 CloudFella 0x000eeea6 main + 94
43 libdyld.dylib 0x034af6d9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
#
If I log into the other cloud services available in my app (Google drive , dropbox, evernote) I got no issues at all.
The problem is happening with both the old LiveSDK API (the one included in the current good release out in the store) and the newest build (2 months old) added to the app to solve some validation issues described here: https://github.com/liveservices/LiveSDK-for-iOS/issues/43
I suspect that going from Xcode 5 to xcode 6 something changed in the building parameters that is causing the issue, however I am not sure where the issue is and how to workaround.
As test I forced building the app for 32 bit architectures only but it crashed as well: this was expected as the LiveSDK API is compatible with 64 bit arch, but certainly wanted to try... .
Any help is greatly appreciated.
Thanks,
dom
Turns out this may be indeed a bug on the liveSDK.
Opened the following issue:
https://github.com/liveservices/LiveSDK-for-iOS/issues/53
and another API user (https://github.com/sylverb) that ran into the same issue gave me a good workaround until the bug is fixed:
"It was crashing because of "[authRefreshRequest cancel];" in the release method of LiveConnectClientCore.m . I had a temporary fix by adding "self" at this line in refreshSessionWithDelegate method (also in LiveConnectClientCore.m) :
self.authRefreshRequest = [[[LiveAuthRefreshRequest alloc] initWithClientId:_clientId
scope:_scopes
refreshToken:refreshToken
delegate:delegate
userState:userState
clientStub:self]
autorelease];
"
Closing the post as solved because a workaround is provided and I added a link to the open bug opened for any other user that wants to follow up on this issue.

Resources