ios 8 + LiveSDK authentication crashes my app - ios

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.

Related

Unrecognized selector sent to instance - Application crashes only on Release

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?

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.

How to debug a main.m iOS app crash

I have integrated Crashlytics in my iOS app which is currently live on the App Store. In my latest update, I am seeing a lot of crashes with the stack trace as below.
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x30f6ef46 objc_msgSend + 5
1 UIKit 0x26665f07 -[UINavigationController viewWillAppear:] + 406
2 UIKit 0x265d5b1f -[UIViewController _setViewAppearState:isAnimating:] + 438
3 CoreFoundation 0x22fcf46d __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 48
4 CoreFoundation 0x22fc84c3 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 234
5 UIKit 0x265d5c9b -[UIViewController _setViewAppearState:isAnimating:] + 818
6 UIKit 0x2688c799 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 584
7 UIKit 0x26639bd9 _applyBlockToCFArrayCopiedToStack + 308
8 UIKit 0x265b5dd7 _afterCACommitHandler + 458
9 CoreFoundation 0x23069ffd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
10 CoreFoundation 0x230676bb __CFRunLoopDoObservers + 278
11 CoreFoundation 0x23067ac3 __CFRunLoopRun + 914
12 CoreFoundation 0x22fb53b1 CFRunLoopRunSpecific + 476
13 CoreFoundation 0x22fb51c3 CFRunLoopRunInMode + 106
14 GraphicsServices 0x2a5a2201 GSEventRunModal + 136
15 UIKit 0x2661f43d UIApplicationMain + 1440
16 MyApp 0x00123553 main (main.m:16)
I recently added interstitial ads in my app and I believe the crash is related to that. But how can I get more information from this stack trace or from crashlytics to understand what is really going wrong?
Have you tried enabling Exception Breakpoints?
1) Inside Xcode, switch to the Breakpoints Navigator (left menu, seventh icon from left to right, it looks just like a breakpoint)
2) Click the + symbol in the lower left corner and choose "Add Exception Breakpoint"
3) Run and crash.
You should now be able to see what really caused the crash.

How can I debug this crash log

I get this crash log from my device log after that my app is crashed. Before crash I clicked on cancel button from search bar inside UITableView.
How can I understand what and where is the problem ?
how can I debug this kind of log from production device?
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3b74b1fc __pthread_kill + 8
1 libsystem_pthread.dylib 0x3b7b2a4e pthread_kill + 54
2 libsystem_c.dylib 0x3b6fc028 abort + 72
3 libc++abi.dylib 0x3ab4a98a abort_message + 70
4 libc++abi.dylib 0x3ab636e2 default_terminate_handler() + 250
5 libobjc.A.dylib 0x3b19b936 _objc_terminate() + 190
6 libc++abi.dylib 0x3ab611b0 std::__terminate(void (*)()) + 76
7 libc++abi.dylib 0x3ab60d12 __cxa_rethrow + 98
8 libobjc.A.dylib 0x3b19b80a objc_exception_rethrow + 38
9 CoreFoundation 0x30d724e2 CFRunLoopRunSpecific + 638
10 CoreFoundation 0x30d7224e CFRunLoopRunInMode + 102
11 GraphicsServices 0x35aac2e6 GSEventRunModal + 134
12 UIKit 0x33627840 UIApplicationMain + 1132
13 MYAPPNAME 0x000ffc44 0xfa000 + 23620
14 libdyld.dylib 0x3b694ab4 start + 0
------- EDITED ------
i get Last Exception Backtrace:
0 CoreFoundation 0x30e3ee7e __exceptionPreprocess + 126
1 libobjc.A.dylib 0x3b19b6c2 objc_exception_throw + 34
2 CoreFoundation 0x30e3ed50 +[NSException raise:format:arguments:] + 100
3 Foundation 0x317e70aa -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 86
4 UIKit 0x33796348 -[UITableView _endCellAnimationsWithContext:] + 7940
5 MYAPPNAME 0x00233972 0xfa000 + 1284466
6 MYAPPNAME 0x00232e3c 0xfa000 + 1281596
7 MYAPPNAME 0x00232fd8 0xfa000 + 1282008
8 MYAPPNAME 0x002319d4 0xfa000 + 1276372
9 Foundation 0x3181933a __NSFireDelayedPerform + 410
10 CoreFoundation 0x30e09e7a
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 10
11 CoreFoundation 0x30e09a96 __CFRunLoopDoTimer + 790
12 CoreFoundation 0x30e07e1e __CFRunLoopRun + 1214
13 CoreFoundation 0x30d7246c CFRunLoopRunSpecific + 520
14 CoreFoundation 0x30d7224e CFRunLoopRunInMode + 102
15 GraphicsServices 0x35aac2e6 GSEventRunModal + 134
16 UIKit 0x33627840 UIApplicationMain + 1132
17 MYAPPNAME 0x000ffc44 0xfa000 + 23620
18 libdyld.dylib 0x3b694ab2 tlv_initializer + 2
The crash happened because of an unhandled exception.
While symbolicating the crash report with the Xcode organizer usually helps, it doesn't help in this case, since stack frame 13 will only show something like main (main.m:14).
If the crash report doesn't contain an Last Exception Backtrace section, the report is basically meaningless.
Try to reproduce the crash while running the app with the debugger or integrate a 3rd party crash report solution that is able to provide the Last Exception Backtrace and also the Application Information section which gives you the detailed exception error.
There are many 3rd party solutions out there, I won't recommend any, since I would be biased :)
Update: As you now provided the Last Exception Backtrace it shows that there is an Assertion triggered when a tableview animation is ending. Once you symbolicates the crash report you'll see which lines of code in your app are causing this.

In iOS, what caused this crash?

I got a crash in my iOS app, but their has only a few messages, some like this.
Application received signal SIGABRT
(null)
(
0 CoreFoundation 0x359c68a7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x37d6d259 objc_exception_throw + 32
2 CoreFoundation 0x359c6789 +[NSException raise:format:] + 0
3 CoreFoundation 0x359c67ab +[NSException raise:format:] + 34
4 myapp 0x00241bf9 _ZNSt11_Deque_baseIsSaIsEE15_M_create_nodesEPPsS3_ + 1432772
5 libsystem_c.dylib 0x32dd27e3 _sigtramp + 38
6 libsystem_c.dylib 0x32dc820f pthread_kill + 54
7 libsystem_c.dylib 0x32dc129f abort + 94
8 libc++abi.dylib 0x35d7ef6b abort_message + 46
9 libc++abi.dylib 0x35d7c3f1 _ZL19safe_handler_callerPFvvE + 120
10 libc++abi.dylib 0x35d7c451 _ZdlPv + 0
11 libc++abi.dylib 0x35d7d825 __cxa_current_exception_type + 0
12 libobjc.A.dylib 0x37d6d2a9 objc_exception_rethrow + 12
13 CoreFoundation 0x3591c50d CFRunLoopRunSpecific + 404
14 CoreFoundation 0x3591c36d CFRunLoopRunInMode + 104
15 GraphicsServices 0x375b8439 GSEventRunModal + 136
16 UIKit 0x33428cd5 UIApplicationMain + 1080
17 myapp 0x000d4293 _mh_execute_header + 41619
18 myapp 0x000ccd20 _mh_execute_header + 11552
)
I can't find what caused this crash, but it is the most frequently appears in my app. I am very anxious, does any one know something about it? Thanks a lot.
If you are able to reproduce this crash either by performing a certain task or just using the app long enough you could attach the debugger and set a breakpoint for [NSException raise]. This way you can figure out in what part of your application stuff is messed up, I used this in the past to figure out where a NSArray went out of bounds.. ( and I have like a dozen or more spread around all source files )
Secondly you should probably 'symbolicate' the crash report so you can follow the stack trace.. so you can figure out what method/class in your code is messing stuff up.
For see a crash callback, try add in your project this great feature:
CrashKit
This is a exception catcher

Resources