IOS app crashing only if installed from app store - ios

I'm having a problem where if I run my app from installing it from the app store it's crashing (On multiple devices). But when I run the exact same code on the device from xCode it works fine.
I've been researching and the only suggestions I can find are to run in Release mode and change Optimization Level to fastest,smallest. Which I tried but it still doesn't crash. Heres the crash log I got:
Incident Identifier: 56DF41AE-4A6A-4328-A50E-03B2ECC245F5
CrashReporter Key: fabdf09dfea5dfb3a78e5ce49b1fda0291703647
Hardware Model: iPod4,1
Process: MobileScripts [356]
Path: /var/mobile/Applications/24524BCA-F897-45FE-87E5-3C807733C9C6/MobileScripts.app/MobileScripts
Identifier: MobileScripts
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-12-12 13:28:29.474 -0600
OS Version: iOS 6.1.5 (10B400)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3195d29e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x395dd97a objc_exception_throw + 26
2 CoreData 0x316fe0d6 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 294
3 CoreData 0x317566de -[NSManagedObjectContext save:] + 726
4 MobileScripts 0x0002ce0a -[XML parser:didEndElement:namespaceURI:qualifiedName:] (XML.m:105)
5 Foundation 0x3227b28a _endElementNs + 298
6 libxml2.2.dylib 0x398f3e58 xmlParseEndTag2 + 612
7 libxml2.2.dylib 0x398f5546 xmlParseTryOrFinish + 1658
8 libxml2.2.dylib 0x398f4ce8 xmlParseChunk + 208
9 Foundation 0x32279d66 -[NSXMLParser parse] + 482
10 MobileScripts 0x0002c664 -[XML parseXml:] (XML.m:32)
11 MobileScripts 0x00034686 -[WebService parse] (WebService.m:114)
12 Foundation 0x322986f8 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 + 12
13 Foundation 0x321d81f4 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 196
14 Foundation 0x321d8110 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 56
15 CFNetwork 0x3163a45a ___delegate_didFinishLoading_block_invoke_0 + 22
16 CFNetwork 0x31639b3e ___withDelegateAsync_block_invoke_0 + 50
17 CFNetwork 0x31661fc6 ___performAsync_block_invoke_068 + 14
18 CoreFoundation 0x318a3748 CFArrayApplyFunction + 172
19 CFNetwork 0x31662426 RunloopBlockContext::perform() + 70
20 CFNetwork 0x315c6038 MultiplexerSource::perform() + 184
21 CoreFoundation 0x3193267e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 10
22 CoreFoundation 0x31931ee4 __CFRunLoopDoSources0 + 208
23 CoreFoundation 0x31930cb2 __CFRunLoopRun + 642
24 CoreFoundation 0x318a3eb8 CFRunLoopRunSpecific + 352
25 CoreFoundation 0x318a3d44 CFRunLoopRunInMode + 100
26 GraphicsServices 0x354562e6 GSEventRunModal + 70
27 UIKit 0x337b92fc UIApplicationMain + 1116
28 MobileScripts 0x0002c58e main (main.m:16)
29 libdyld.dylib 0x39a14b1c tlv_initializer + 4
I see that it doesn't like what I have on line 105 in XML.m, which is just a context save:
[context save:&saveError];
And like I said this line works just fine when I run it from xcode. Does anyone have any suggestions on how I can get more information on the exception or make this issue occur while debugging?
Thanks for any help.
EDIT:
I watched the device log during the crash and found out the exception is "'NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'". Any idea as to why this is only happening from the app store?

Connect the device to Xcode or the iPhone configurations program and watch the log.
Also how looks the scope of the save statement. Is there a try catch around it? You have a NSError object that should have the info. Usualy it get logged using NSLog.
Edit:
Where get the store created path wise and has the device enough room to create the store?
I am taking a guess. Are you delivering the persistence store with your app? Lets say a sqllight database that is part of the app? You may read files from your app but never write to. You need to move the pre made persistence store to one of the directories you have write access.

Related

How to understand app rejection with crashlogs?

My app was rejected with this reason:
Your app crashed on iPad running iOS 13.4.1 on WiFi when we:
Tapped on any locked content
Tapped on the settings icon
We have attached detailed crash logs to help troubleshoot this issue.
I tested my app. Everything work fine. How can I find the error?
One of three crashlogs:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010403514c
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [630]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 appTime 0x000000010403514c 0x104014000 + 135500
1 appTime 0x00000001040351b8 0x104014000 + 135608
2 UIKitCore 0x00000001acfece08 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100
3 UIKitCore 0x00000001acff1898 -[UIViewController loadViewIfRequired] + 936
4 UIKitCore 0x00000001acff1ca0 -[UIViewController view] + 28
5 UIKitCore 0x00000001acf1cccc -[_UIFullscreenPresentationController _setPresentedViewController:] + 80
6 UIKitCore 0x00000001acf10810 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 188
7 UIKitCore 0x00000001ad0014bc -[UIViewController _presentViewController:withAnimationController:completion:] + 2616
8 UIKitCore 0x00000001ad004014 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 104
9 UIKitCore 0x00000001ad00451c -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 508
10 UIKitCore 0x00000001ad003f64 -[UIViewController _presentViewController:animated:completion:] + 196
11 UIKitCore 0x00000001ad0041d0 -[UIViewController presentViewController:animated:completion:] + 164
12 UIKitCore 0x00000001ad791db0 __67-[UIStoryboardModalSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 248
13 UIKitCore 0x00000001ad796ac4 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 292
14 UIKitCore 0x00000001ad796970 -[UIStoryboardSegueTemplate _perform:] + 92
15 UIKitCore 0x00000001acff43b0 -[UIViewController performSegueWithIdentifier:sender:] + 104
16 appTime 0x0000000104023c44 0x104014000 + 64580
17 appTime 0x0000000104023338 0x104014000 + 62264
18 UIKitCore 0x00000001ad80bb4c -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:] + 1200
19 UIKitCore 0x00000001ad80b684 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 108
20 UIKitCore 0x00000001ad80be8c -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 268
21 UIKitCore 0x00000001ad63b94c _runAfterCACommitDeferredBlocks + 316
22 UIKitCore 0x00000001ad62b2f4 _cleanUpAfterCAFlushAndRunDeferredBlocks + 232
23 UIKitCore 0x00000001ad65b744 _afterCACommitHandler + 76
24 CoreFoundation 0x00000001a9504fb8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
25 CoreFoundation 0x00000001a94ffeac __CFRunLoopDoObservers + 420
26 CoreFoundation 0x00000001a9500328 __CFRunLoopRun + 968
27 CoreFoundation 0x00000001a94ffc34 CFRunLoopRunSpecific + 424
28 GraphicsServices 0x00000001b364938c GSEventRunModal + 160
29 UIKitCore 0x00000001ad63222c UIApplicationMain + 1932
30 appTime 0x000000010401b3ec 0x104014000 + 29676
31 libdyld.dylib 0x00000001a9387800 start + 4
Short answer, you use the crashlog to identify the part of code where the app crashed, and be effective with writing a fix.
Now the long answer:
Refer to the Technical Note TN2151 - Understanding and Analyzing Application Crash Reports on Apple Developer website.
When an application crashes, a crash report is created and stored on the device. Crash reports describe the conditions under which the application terminated, in most cases including a complete backtrace for each executing thread, and are typically very useful for debugging issues in the application. You should look at these crash reports to understand what crashes your application is having, and then try to fix them.
and
Crash reports with backtraces need to be symbolicated before they can be analyzed. Symbolication replaces memory addresses with human-readable function names and line numbers. If you get crash logs off a device through Xcode's Devices window, then they will be symbolicated for you automatically after a few seconds. Otherwise you will need to symbolicate the .crash file yourself by importing it to the Xcode Devices window. See Symbolicating Crash Reports for details.
So to put it simply, when you build your app with Xcode, the compiler also generates debug symbols. You should generally store the debug symbols in a dSYM file corresponding to the build that you submit for review.
If your app crashes during review, the App Store Review team member fetches and shares the crash log with you. Now the crash log contains machine (assembly language) instructions, and your can use Xcode to symbolicate the crash report. Doing this would convert the machine symbols into the name of identifies that you have in your code, which would help you with determining the section of code where the crash occurred.
Consider reading the attached technical note to understand how you can easily determine the part of code where your app crashed and be more effective with fix.

Xcode crash report KERN_INVALID_ADDRESS at 0x0000000100001da0

I'm having a tough time figuring this crash report sent to me by Apple. For some reason they keep telling me that my app crashes on start but I cannot recreate the crash after testing it on different devices. As I'm not sure what's causing it to crash and not being able to recreate the crash, I was wondering if anyone can help shed some light on what the problem could be?
And some extra info, I'm using AsyncImageView 1.5.1 and the Reachability class. I'm not sure if that could be the source of the crash?
Any help would be greatly appreciated. Thanks a lot!
OS Version: iOS 8.0.2 (12A405)
Report Version: 105
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000100001da0
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x0000000194c880b4 objc_retain + 20
1 MyApp 0x0000000100113274 0x1000f4000 + 127604
2 MyApp 0x0000000100111a84 0x1000f4000 + 121476
3 CoreFoundation 0x0000000184324430 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 16
4 CoreFoundation 0x00000001842637dc _CFXNotificationPost + 2056
5 Foundation 0x000000018515b6bc -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
6 MyApp 0x000000010011099c 0x1000f4000 + 117148
7 Foundation 0x000000018524a7ec __NSThreadPerformPerform + 368
8 CoreFoundation 0x0000000184336320 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20
9 CoreFoundation 0x00000001843355c4 __CFRunLoopDoSources0 + 260
10 CoreFoundation 0x0000000184333674 __CFRunLoopRun + 708
11 CoreFoundation 0x0000000184261660 CFRunLoopRunSpecific + 392
12 GraphicsServices 0x000000018d35f5a0 GSEventRunModal + 164
13 UIKit 0x0000000188b664f4 UIApplicationMain + 1484
14 MyApp 0x00000001000fab44 0x1000f4000 + 27460
15 libdyld.dylib 0x00000001952dea04 start + 0

iOS MagicalRecord Crash on launch

I'm having an issue where some users are getting a crash on launch in my native iOS app using MagicalRecord (shorthand) v2.2.
This is not a classic database migration issue as firstly it doesn't occur for all users, and secondly the database schema has not been changed (I have git logs proving this and just in case I tried to reproduce after making some db changes but was not successful).
Deleting and recreating the database does seem to work however as the fallback code in the app clears and recreates the database if it has detected that it has crashed due to this issue previously. The crash logs indicate that this works as there is a 1 to 1 ratio of unique devices and number of crashes.
All that happens on launch related to the db is the following:
[MagicalRecord setErrorHandlerTarget:self action:#selector(handleCoreDataError:)];
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:#"xxx.sqlite"];
The stack trace on the main thread:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x37d3f626 objc_msgSend + 5
1 Foundation 0x2dec102d -[NSError dealloc] + 60
2 libobjc.A.dylib 0x37d44b6b objc_object::sidetable_release(bool) + 174
3 libobjc.A.dylib 0x37d450d3 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 358
4 CoreFoundation 0x2d4d24c1 _CFAutoreleasePoolPop + 16
5 Foundation 0x2decb8e3 -[NSAutoreleasePool drain] + 122
6 CoreData 0x2d312fbf -[NSManagedObjectContext save:] + 942
7 xxx 0x00249223 __70-[NSManagedObjectContext(MagicalSaves) MR_saveWithOptions:completion:]_block_invoke3 (NSManagedObjectContext+MagicalSaves.m:64)
8 CoreData 0x2d3769cd developerSubmittedBlockToNSManagedObjectContextPerform + 88
9 libdispatch.dylib 0x3821ed3f _dispatch_client_callout + 22
10 libdispatch.dylib 0x382216c3 _dispatch_main_queue_callback_4CF + 278
11 CoreFoundation 0x2d569681 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
12 CoreFoundation 0x2d567f4d __CFRunLoopRun + 1308
13 CoreFoundation 0x2d4d2769 CFRunLoopRunSpecific + 524
14 CoreFoundation 0x2d4d254b CFRunLoopRunInMode + 106
15 GraphicsServices 0x3243f6d3 GSEventRunModal + 138
16 UIKit 0x2fe31891 UIApplicationMain + 1136
17 xxx 0x0002e3cc main (main.m:18)
Well, this error seems like you're overreleasing the error object. Are you explicitly calling [error release] or [error autorelease] somewhere?

What is causing this iOS App Crash Report?

I need some help to find out what could be causing this Crash Report. Unfortunately, none of our users that have submitted similar Crash Reports have given us any additional information that will help even pinpoint what they are doing in the app at the time of the crash. Nothing in the report seems to be linked to my code directly (ie it all seems to be built-in Framework calls). I can't simulate this myself, so it's going to be tough to know when/if I have resolved this.
Anyway, here's the Crash Report:
Incident Identifier: 4A302435-AF92-4B80-837D-E8161C05FA6B
CrashReporter Key: [TODO]
Hardware Model: iPad2,6
Process: MyApp [213]
Path: /var/mobile/Applications/1065CCF2-93EE-4D8E-A07C-XXXXXEE6XXXX/MyApp.app/MyApp
Identifier: MyApp
Version: 325
Code Type: ARM
Parent Process: launchd [1]
Date/Time: 2013-10-01 06:24:49 0000
OS Version: iPhone OS 7.0.2 (11A501)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xb17b688c
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x399fdb26 objc_msgSend + 6
1 Foundation 0x2fb033a3 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 55
2 Foundation 0x2fb032e7 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 207
3 Foundation 0x2fb03201 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 61
4 CFNetwork 0x2ee36ed3 ___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 75
5 CFNetwork 0x2ee35ae3 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 55
6 CFNetwork 0x2ee6731f ___ZNK17CoreSchedulingSet13_performAsyncEPKcU13block_pointerFvvE_block_invoke + 19
7 CoreFoundation 0x2f0fd719 CFArrayApplyFunction + 37
8 CFNetwork 0x2edcdc3d RunloopBlockContext::perform() + 165
9 CFNetwork 0x2edcdb0d MultiplexerSource::perform() + 221
10 CFNetwork 0x2edcd9a1 MultiplexerSource::_perform(void*) + 49
11 CoreFoundation 0x2f19518b __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
12 CoreFoundation 0x2f19465b __CFRunLoopDoSources0 + 207
13 CoreFoundation 0x2f192e4f __CFRunLoopRun + 623
14 CoreFoundation 0x2f0fdce7 CFRunLoopRunSpecific + 523
15 CoreFoundation 0x2f0fdacb CFRunLoopRunInMode + 107
16 GraphicsServices 0x33df8283 GSEventRunModal + 139
17 UIKit 0x3199fa41 _UIApplicationMain 1137
18 MyApp 0x0016a60f _main 187

iPhone App Rejected by Apple with crash report - can not reproduce

I am totally at a loss on this crash report. I have several fairly complicated apps already in the store and recently submitted an update to one of them. I promptly received the response it had been rejected for crashing on startup. They are using exactly the same SDK version as me, 3.1.2. After symbolicating the stack trace, this is what was crashing:
Process: MyAppName [60]
Path: /var/mobile/Applications/0EC19245-D3A4-47D0-94D9-XXXXXXXXXX/MyAppName.app/MyAppName
Identifier: MyAppName
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2010-01-19 15:43:46.804 -0800
OS Version: iPhone OS 3.1.2 (7D11)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
and this is the pertinent stack trace.
Thread 0 Crashed:
0 libSystem.B.dylib 0x0007e9ac __kill + 8
1 libSystem.B.dylib 0x0007e99c kill + 4
2 libSystem.B.dylib 0x0007e98e raise + 10
3 libSystem.B.dylib 0x0009363a abort + 34
4 libstdc++.6.dylib 0x000453b0 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x00005858 _objc_terminate + 104
6 libstdc++.6.dylib 0x00043776 __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x000437ca std::terminate() + 10
8 libstdc++.6.dylib 0x00043896 __cxa_throw + 74
9 libobjc.A.dylib 0x00004714 objc_exception_throw + 64
10 Foundation 0x000013c2 __NSThreadPerformPerform + 570
11 CoreFoundation 0x00056a96 CFRunLoopRunSpecific + 1834
12 CoreFoundation 0x00056356 CFRunLoopRunInMode + 42
13 GraphicsServices 0x00003cb8 GSEventRunModal + 108
14 GraphicsServices 0x00003d64 GSEventRun + 56
15 UIKit 0x00002768 -[UIApplication _run] + 384
16 UIKit 0x0000146c UIApplicationMain + 688
17 MyAppName 0x0000ed6a main (main.m:13)
18 MyAppName 0x000028e4 start + 44
To me that stacktrace is near useless, it just says a component crashed when we started your app yet I can not reproduce it on a similar system (the only difference being they are running Snow Leopard and I am just running Leopard).
Any suggestions as to what I could next? Thanks.
If you are running Snow Leopard, turn on the Static Analyzer in your project.
Turn on NSZombieEnabled
http://www.frogameleon.com/blog/last-night-an-iphone-zombie-nszombieenabled-saved-my-life
Review the other Debugging docs and use the tools Apple provides.
http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/130-Debugging_Applications/debugging_applications.html
Actually it doesn't say a component crashed when you started the app. The crash may have happened at any point.
What it does say though, is that it crashed in NSThreadPerform, which seems like you were trying to call performSelector on either an object that no longer existed, or possibly against an object that did not have the method you were trying to invoke.
So I'd look for anywhere you use performSelector on the main thread, and try and think from there how the target could be invalid.

Resources