My Objective-C application is using a 3rd party VoIP SDK. I found the application crashes if left running overnight. The crash only happens if I enable the SDK, so I strongly suspect it causes the crash.
The library is a static library (.a extension). I tried catching the exception using try-catch block, and NSSetUncaughtExceptionHandler, but it didn't work. I suspect those methods only work with Objective-C exceptions, and the SDK is written in native C?
Is it possible to catch a 3rd party native C exception? I'm fine with any kind of hacks, since this will not be going into production code. Just trying to get to the bottom of the issue.
EDIT:
Here's the crash log:
Hardware Model: iPad5,1
Version: 0.14 (6.0)
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Date/Time: 2016-11-22 08:24:59.7336 -0500
Launch Time: 2016-11-21 13:45:09.9956 -0500
OS Version: iPhone OS 10.1.1 (14B100)
Report Version: 104
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:
(0x18953e1c0 0x187f7855c 0x18953e108 0x18f89359c 0x18f6f4444 0x18f4c653c
0x18f391d48 0x18f391c78 0x18f44bb10 0x18f44aec0 0x18f44a90c 0x18f44a4c0
0x18f44a424 0x18f38f220 0x18c84f188 0x18c843e64 0x18c843d24 0x18c7c07ec
0x18c7e7c58 0x18c7e8678 0x1894eb7dc 0x1894e940c 0x1894e989c 0x189418048
0x18ae9e198 0x18f3fd2fc 0x18f3f8034 0x10002304c 0x1883fc5b8)
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018850e014 0x1884ef000 + 126996
1 libsystem_pthread.dylib 0x00000001885d6450 0x1885d1000 + 21584
2 libsystem_c.dylib 0x00000001884823e0 0x18841f000 + 406496
3 libc++abi.dylib 0x0000000187f4d2d4 0x187f4c000 + 4820
4 libc++abi.dylib 0x0000000187f6acc0 0x187f4c000 + 126144
5 libobjc.A.dylib 0x0000000187f78844 0x187f70000 + 34884
6 libc++abi.dylib 0x0000000187f6766c 0x187f4c000 + 112236
7 libc++abi.dylib 0x0000000187f67234 0x187f4c000 + 111156
8 libobjc.A.dylib 0x0000000187f7871c 0x187f70000 + 34588
9 CoreFoundation 0x00000001894180bc 0x18940f000 + 37052
10 GraphicsServices 0x000000018ae9e198 0x18ae92000 + 49560
11 UIKit 0x000000018f3fd2fc 0x18f382000 + 504572
12 UIKit 0x000000018f3f8034 0x18f382000 + 483380
13 Remote 0x000000010002304c 0x100008000 + 110668
14 libdyld.dylib 0x00000001883fc5b8 0x1883f8000 + 17848
That isn't a catchable exception, that is a hard crash. And, specifically, it is a purposeful crash; something on the main thread decided things had gone badly enough that it called abort().
So, no, nothing you can do to catch it and it isn't even clear that the crash is triggered by the 3rd party library, given that crash log.
Related
I usually develop in higher level languages like Javascript and Python , so I am not that experienced when it comes to reading lower level stack traces. I am building an iOS app with React Native and my app sometimes unexpectedly crashes. Reading the crash log this is what I get:
Incident Identifier: B03D5F95-EFD1-4FEB-AE18-C8EFEF273E53
CrashReporter Key: 6049c1cc93a2e0163265631aa6cc2fd30a1af6e7
Hardware Model: iPhone7,2
Process: MyApp [24268]
Path: /private/var/containers/Bundle/Application/99B2B9A1-D266-4222-A083-84C4CFFCE182/MyApp.app/MyApp
Identifier: org.mycompany.MyApp
Version: 1 (1.0)
Code Type: ARM-64 (Native)
Role: Non UI
Parent Process: launchd [1]
Coalition: org.mycompany.MyApp [3119]
Date/Time: 2019-03-04 14:20:18.4924 +0800
Launch Time: 2019-03-04 14:09:15.2536 +0800
OS Version: iPhone OS 11.0.3 (15A432)
Baseband Version: 6.17.00
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace <0xF>, Code 0x8badf00d
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000180a60bc4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000180a60a3c mach_msg + 72
2 BackBoardServices 0x00000001835d0de0 _BKSHIDGetCurrentDisplayBrightness + 112
3 BackBoardServices 0x00000001835de9cc BKSDisplayBrightnessGetCurrent + 32
4 FrontBoardServices 0x00000001835fffc0 -[FBSUIApplicationSystemService currentBacklightLevel] + 12
5 UIKit 0x000000018a8a3d44 -[UIDevice _backlightLevel] + 44
6 UIKit 0x000000018a8aced4 -[UIScreen _postBrightnessDidChangeNotificationIfAppropriate] + 168
7 CoreFoundation 0x0000000180efa12c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
8 CoreFoundation 0x0000000180efa090 ___CFXRegistrationPost_block_invoke + 64
9 CoreFoundation 0x0000000180f1016c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
10 CoreFoundation 0x0000000180f0fa3c __CFRunLoopDoBlocks + 288
11 CoreFoundation 0x0000000180f0dca4 __CFRunLoopRun + 2436
12 CoreFoundation 0x0000000180e2e2d8 CFRunLoopRunSpecific + 436
13 GraphicsServices 0x0000000182cbff84 GSEventRunModal + 100
14 UIKit 0x000000018a3db880 UIApplicationMain + 208
15 MyApp 0x00000001005833d4 main + 29652 (main.m:14)
16 libdyld.dylib 0x000000018095256c start + 4
How/where do I begin reading thsi crash log? I believe it has something to do with mach_msg_trap but I haven't been able to find anything about it. For some context, my app is an app which tracks the users Geolocation with background geolocation tracking. I am unable to figure out what causes the crash.
See TN2141: Understanding and Analyzing Application Crash Reports, which says:
The exception code 0x8badf00d indicates that an application has been terminated by iOS because a watchdog timeout occurred. The application took too long to launch, terminate, or respond to system events. ... Whatever operation is on Thread 0 needs to be moved to a background thread, or processed differently, so that it does not block the main thread.
Are you doing anything that could be blocking the main thread for any prolonged period of time?
Have you add Privacy - Location in info.plist?
Something like that.
<key>NSLocationAlwaysUsageDescription</key>
<string>Why you need track location?</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Why you need track location?</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Why you need track location?</string>
And I see you work with background geolocation tracking. Have you turn on Background Modes in Capabilities?
If not just add Privacy turn on Background Modes and try again.
I've tested my apps with all sort of iOs version and result is working fine on those devices. But when I published to App Store, they rejected that app is crashed on launch. I cannot convince why app is crashed on their phone even I've tested with same iOs version.
Please let me know, how to solve that issue and I've attached error logs.
{"app_name":"CakeApp","timestamp":"2017-08-10 06:54:09.29 -0700","app_version":"3","slice_uuid":"ba63de93-382a-3879-933d-e584d00cb7aa","adam_id":1233988265,"build_version":"1.2","bundleID":"com.ppshein.CakeApp","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 10.3.3 (14G60)","incident_id":"81B4B45E-ACB0-4305-81BE-B88E4E257238","name":"CakeApp"}
Incident Identifier: 81B4B45E-ACB0-4305-81BE-B88E4E257238
CrashReporter Key: 318083a7319cbe05fd01b4c953a58aebe938f998
Hardware Model: xxx
Process: CakeApp [5822]
Path: /private/var/containers/Bundle/Application/126924F1-2DBF-4F12-8355-1C5787680F75/CakeApp.app/CakeApp
Identifier: com.ppshein.CakeApp
Version: 1.2 (3)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.ppshein.CakeApp [1034]
Date/Time: 2017-08-10 06:54:09.0262 -0700
Launch Time: 2017-08-10 06:54:06.9573 -0700
OS Version: iPhone OS 10.3.3 (14G60)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001002749c8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [0]
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CakeApp 0x00000001002749c8 0x100098000 + 1952200
1 CakeApp 0x000000010026dca4 0x100098000 + 1924260
2 UIKit 0x00000001930eae48 0x19306a000 + 527944
3 UIKit 0x00000001932f737c 0x19306a000 + 2675580
4 UIKit 0x00000001932fce24 0x19306a000 + 2698788
5 UIKit 0x00000001933118b0 0x19306a000 + 2783408
6 UIKit 0x00000001932fa0b8 0x19306a000 + 2687160
7 FrontBoardServices 0x000000018eaf8884 0x18eabe000 + 239748
8 FrontBoardServices 0x000000018eaf86f0 0x18eabe000 + 239344
9 FrontBoardServices 0x000000018eaf8aa0 0x18eabe000 + 240288
10 CoreFoundation 0x000000018cefd42c 0x18ce22000 + 898092
11 CoreFoundation 0x000000018cefcd9c 0x18ce22000 + 896412
12 CoreFoundation 0x000000018cefa9a8 0x18ce22000 + 887208
13 CoreFoundation 0x000000018ce2ada4 0x18ce22000 + 36260
14 UIKit 0x00000001930e3fc8 0x19306a000 + 499656
15 UIKit 0x00000001930dec9c 0x19306a000 + 478364
16 CakeApp 0x00000001000a5e3c 0x100098000 + 56892
17 libdyld.dylib 0x000000018be3959c 0x18be35000 + 17820
Did you test your app in a clean environment? Uninstall the app and delete all of its data and then install again.
You can try to resolve the crash by symbolicating the stack trace, as described in this technical note from Apple, which can help you identify the part of your code that crashed.
this was apple's message
14.3 Details
Your app enables the display of user-generated content but does not
have the required precautions in place.
Next Steps
It is necessary that you put all of the following precautions in
place:
Require that users agree to terms (EULA) and these terms must make it clear that there is no tolerance for objectionable content
Use moderators to flag and remove inappropriate content and offensive users
Users need a mechanism to flag objectionable content and report users generating this content
Users need a mechanism to block abusive users
Developer must act on objectionable content reports within 24 hours by removing the content and ejecting the user who provided the
offending content
Developer needs a method for ejecting users who violate the terms of the EULA
2.1 Details
During review, your app crashed on iPad running iOS 9.3.1 and iPhone
running iOS 9.3.1 when we:
Tap "..." On a post
This occurred when your app was used:
- Offline
- On Wi-Fi
- On cellular network
my app has a privacy policy & terms of service. also it has a more button which you can report things in it.. its the "..." button that crashes
the thing is it never crashed while trying it on multiple devices iPhones and iPads! i don't get why it keeps being rejected!
first time i sent it without terms of service but now i added it and resent it. but it got rejected again!
the crash log they sent is
Version: 1.1 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2016-04-14 19:54:17.17 -0700
Launch Time: 2016-04-14 19:53:55.55 -0700
OS Version: iOS 9.3.1 (13E238)
Report Version: 105
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
(0x182c06e38 0x18226bf80 0x188695288 0x1880a9ec0 0x1880a7fd8 0x187ffafd8 0x188008990 0x187d3a4a4 0x182bbc7b0 0x182bba554 0x182bba984 0x182ae4d10 0x1843cc088 0x187db1f70 0x10011ccb0 0x1826828b8)
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001827a011c 0x182784000 + 114972
1 libsystem_pthread.dylib 0x000000018286cef8 0x182868000 + 20216
2 libsystem_c.dylib 0x0000000182711dac 0x1826b0000 + 400812
3 libc++abi.dylib 0x00000001822453f4 0x182244000 + 5108
4 libc++abi.dylib 0x0000000182261e98 0x182244000 + 122520
5 libobjc.A.dylib 0x000000018226c248 0x182264000 + 33352
6 libc++abi.dylib 0x000000018225ef44 0x182244000 + 110404
7 libc++abi.dylib 0x000000018225eb10 0x182244000 + 109328
8 libobjc.A.dylib 0x000000018226c120 0x182264000 + 33056
9 CoreFoundation 0x0000000182ae4db8 0x182adc000 + 36280
10 GraphicsServices 0x00000001843cc088 0x1843c0000 + 49288
11 UIKit 0x0000000187db1f70 0x187d34000 + 515952
12 iFandoms 0x000000010011ccb0 0x1000c0000 + 380080
13 libdyld.dylib 0x00000001826828b8 0x182680000 + 10424
this is just a part of it.. still it never crashed while i was testing it! please help me! my mind is gonna explode!
Ok so it turns out its a slight problem with the alert controller.. added some code and it worked!
I have developed an iPad application using Xcode 6.3.2.
I submitted my application to the App Store for review where it was reject due to crash.Following is the crash report from iTunes.
Incident Identifier: 88DD7F94-3382-4241-A0D7-C3E7F6D20737
CrashReporter Key: 9881ae0cc3b3fbfccfd0ce1496d2fa08fec08782
Hardware Model: xxx
Path: /private/var/mobile/Containers/Bundle/Application/FDBBD67F-0EF7-43FB-80CB-8308A10A2D29/Vehicle Visuals.app/Vehicle Visuals
Identifier: com.vehiclevisuals.Vehicle-Visuals
Version: 2.0.0 (1.1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-06-12 12:33:57.988 -0700
Launch Time: 2015-06-12 12:22:14.581 -0700
OS Version: iOS 8.3 (12F69)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000195da7bdc 0x195d8c000 + 113628
1 QuartzCore 0x00000001889fdc2c 0x1889ec000 + 72748
2 Vehicle Visuals 0x0000000100126828 0x1000ec000 + 239656
3 Vehicle Visuals 0x0000000100101e80 0x1000ec000 + 89728
4 UIKit 0x0000000189118778 0x1890a4000 + 477048
5 UIKit 0x0000000189116750 0x1890a4000 + 468816
6 UIKit 0x0000000189112000 0x1890a4000 + 450560
7 UIKit 0x00000001890b175c 0x1890a4000 + 55132
8 QuartzCore 0x00000001889f9e18 0x1889ec000 + 56856
9 QuartzCore 0x00000001889f4880 0x1889ec000 + 34944
10 QuartzCore 0x00000001889f4724 0x1889ec000 + 34596
11 QuartzCore 0x00000001889f3eb8 0x1889ec000 + 32440
12 QuartzCore 0x00000001889f3c38 0x1889ec000 + 31800
13 UIKit 0x0000000189137f8c 0x1890a4000 + 606092
14 UIKit 0x0000000189137ef0 0x1890a4000 + 605936
15 CoreFoundation 0x000000018462c2a0 0x18454c000 + 918176
16 CoreFoundation 0x000000018462922c 0x18454c000 + 905772
17 CoreFoundation 0x000000018462955c 0x18454c000 + 906588
18 CoreFoundation 0x00000001845552d0 0x18454c000 + 37584
19 GraphicsServices 0x000000018dc436f8 0x18dc38000 + 46840
20 UIKit 0x000000018911afa8 0x1890a4000 + 487336
21 Vehicle Visuals 0x000000010013a1cc 0x1000ec000 + 319948
22 libdyld.dylib 0x0000000196412a04 0x196410000 + 10756
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
As per the report it crashes on OS Version : iOS 8.3 (12F69).
I tested my app on the all simulators(iPad Air, iPad 2, iPad Retina) with same config(iOS version 8.3 (12F69)) and also tested it on my device (iPad mini) with iOS version 8.3 (12F69), but didn't crashed on my side.
But it crashes on my friend's iPad Air with same iOS version (it gives the same crash report with different invalid address as below)
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype:
KERN_INVALID_ADDRESS at 0x0000000000000020 Triggered by Thread: 0
I don't have the iPad Air so that I could debug using the device.
I also tried to Symbolicated crash report using following command.
xcrun atos -o VehicleVisuals 0x0000000000000020
But it just gives me following hex code.
0x00000020 (in VehicleVisuals)
I following Link for symbolication.
I'm just not being able to recognise where actually is the crash issue.
Please can anybody help me out?
EXC_BAD_ACCESS usually happens because you are sending an Obj-C message to an invalid memory address, what means that you probably are trying to access some deallocated object.
It may be working on other devices because this object is not being released at the same time.
I recently had a similar crash that happened because there was a timer not being invalidated on dealloc, and when the target method was called, that object did no longer exist.
You could try to enable NSZombie objects and see if you find which object is being deallocated. In xCode 6, you can enable them in Product > Scheme > Edit scheme > Diagnostics > Enable Zombie Objects.
Also, there are lots of these kind of errors that NSZombieEnabled can't detect. Unfortunately there is nothing magical to solve it. The second option would be to run your app with instruments (memory leaks specifically) and see if you can get something. If this doesn't work you will have to review your code and check that there are no possibilities that you are trying to access a deallocated object. Hope it helps.
Good luck!
I have already done some research on identifying crash logs but couldn't find solution:
Here are my references:
http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs
http://developer.apple.com/library/ios/#qa/qa1747/_index.html
How to view crash report on xcode 4.2
I do come to know that it is because of Memory Issue but how to find that particular? In my project there are 200 files also there are 4-5 third party libraries are being used.
Here is crash log:
Incident Identifier: BD0F0F41-C60A-4D9C-8386-1B10796CF835
CrashReporter Key: 43c75986a25cae4226726a78b4bf5b543ab87caa
Hardware Model: iPad3,3
Process: BLSOffline [10824]
Path: /var/mobile/Applications/54AAF195-FD1D-4426-BC20-939662ECC56B/BLSOffline.app/BLSOffline
Identifier: BLSOffline
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-07-12 15:24:05.680 +0530
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000013
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3aadd526 0x3aad8000 + 21798
1 BLSOffline 0x000dbb6a 0xc8000 + 80746
2 CoreFoundation 0x32c3f9c0 0x32b7a000 + 809408
3 CoreFoundation 0x32b96fe6 0x32b7a000 + 118758
4 Foundation 0x335530f0 0x334a2000 + 725232
5 CoreFoundation 0x32c11680 0x32b7a000 + 620160
6 CoreFoundation 0x32c10f7a 0x32b7a000 + 618362
7 CoreFoundation 0x32c0fcb2 0x32b7a000 + 613554
8 CoreFoundation 0x32b82eb8 0x32b7a000 + 36536
9 CoreFoundation 0x32b82d44 0x32b7a000 + 36164
10 GraphicsServices 0x367372e6 0x36732000 + 21222
11 UIKit 0x34a982fc 0x34a41000 + 357116
12 BLSOffline 0x000db5fe 0xc8000 + 79358
13 libdyld.dylib 0x3af17b1c 0x3af16000 + 6940
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3afce648 0x3afcd000 + 5704
1 libdispatch.dylib 0x3aefe974 0x3aef6000 + 35188
2 libdispatch.dylib 0x3aefe654 0x3aef6000 + 34388
Thread 2 name: WebThread
Thread 3 name: JavaScriptCore::BlockFree
Thread 4 name: JavaScriptCore::Marking
Thread 5 name: com.apple.NSURLConnectionLoader
Thread 6 name: WebCore: CFNetwork Loader
Thread 7 name: WebCore: LocalStorage
Thread 8 name: com.apple.CFSocket.private
Thread 9 name: com.apple.coremedia.player.async
Thread 10 name: com.apple.coremedia.player.remote
Please let me know how to find cause out of this.
If my application is crashing at random point of times, still can it be possible to upload on AppStore? Will Apple allow such application?
Edit: The major problem is application is not crashing over simulator, it does only on devices. Also on device, when we debug the app, it crashes on curl library code, which is working fine since first day. Then how come sudden crash occurs in application?
If your application is crashing randomly then you need to analyze your code. That you can do in XCode only.Open your Project in XCode and in Product menu you will find the Analyze option (cmd+shift+B) .make sure you have selected "iOS Device" before analyzing it.
other than this you can use the this link:
http://www.raywenderlich.com/23037/how-to-use-instruments-in-xcode
apple will not accept your app if it is crashing.
No, Apple will probably get the crash too and reject your app (it's a risk).
About the crash, it's hard to say, you'll have to run the app from XCode and check there where the crash was.
If it's a memory issue, profile the app from XCode and you'll see there which component is crashing.