How to debug a main.m iOS app crash - ios

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.

Related

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.

iPad Air Overheating for developer

Some of my application users are running iPad Air. I have had reports lately of the application crashing, but all the crash reports are just giving me the standard crashed in main method. After further investigation, I think the problem might be with the iPad overheating when they are taking photos.
Is there anything as a developer I can do to maybe save data before the application crashes from overheating?
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x180591b90 objc_msgSend + 16
1 Foundation 0x1818e2658 __NSFireDelayedPerform + 428
2 CoreFoundation 0x180ed1794 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
3 CoreFoundation 0x180ed1438 __CFRunLoopDoTimer + 884
4 CoreFoundation 0x180eceb4c __CFRunLoopRun + 1520
5 CoreFoundation 0x180df8c50 CFRunLoopRunSpecific + 384
6 GraphicsServices 0x1826e0088 GSEventRunModal + 180
7 UIKit 0x1860da088 UIApplicationMain + 204
8 intelliSPEC21 0x10009b56c main (AdvancedMain.m:10)
9 libdyld.dylib 0x1809968b8 start + 4

New kivy-Ios toolchain, application crashes when portrait orientation is disabled

I tried to create package for iOS 8.2 using new kivy-ios toolchain on OS X 10.9.5. Unfortunately when I disable 'Portrait' orientation in 'Deployment Info' xcode 6.2, application crashes with following output:
2015-03-11 04:48:32.449 testapp[1478:44792] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [SDLLaunchScreenController shouldAutorotate] is returning YES'
*** First throw call stack:
(
0 CoreFoundation 0x000000010f245a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010edcebb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010f2459ad +[NSException raise:format:] + 205
3 UIKit 0x000000010ce4a263 -[UIViewController __supportedInterfaceOrientations] + 644
4 UIKit 0x000000010ce3f9e3 -[UIViewController _preferredInterfaceOrientationGivenStatusBarAndDeviceAndOrientation:] + 64
5 UIKit 0x000000010cd55b43 -[UIWindow setRootViewController:] + 103
6 testapp 0x000000010b940a25 -[SDLUIKitDelegate application:didFinishLaunchingWithOptions:] + 413
7 UIKit 0x000000010cd0b458 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
8 UIKit 0x000000010cd0c002 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2540
9 UIKit 0x000000010cd0ee3e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
10 UIKit 0x000000010cd0dd35 -[UIApplication workspaceDidEndTransaction:] + 179
11 FrontBoardServices 0x0000000112a62243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
12 CoreFoundation 0x000000010f17ac7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
13 CoreFoundation 0x000000010f1709c5 __CFRunLoopDoBlocks + 341
14 CoreFoundation 0x000000010f170785 __CFRunLoopRun + 2389
15 CoreFoundation 0x000000010f16fbc6 CFRunLoopRunSpecific + 470
16 UIKit 0x000000010cd0d7a2 -[UIApplication _run] + 413
17 UIKit 0x000000010cd10580 UIApplicationMain + 1282
18 testapp 0x000000010b93fa9b main + 203
19 libdyld.dylib 0x000000011037f145 start + 1
20 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have done test on iPhone 5s and iOS symulator, both gave me same results.
It worked fine before, on old kivy-ios toolchain, iOS 8.1 and xcode 6.1. The new iOS and xcode is quite new now so I can't find any answer. Only thing I found is this question Kivy-ios sdl2 run on ios in low resolution about low resolution which is another problem that I have too after upgrade.

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.

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.

Resources