I am assuming it is ok to post beta iOS10 issues here, since it is an open beta. The apple forums don't come close to the help one gets on Stackoverflow.
Since the update to iOS10, our users are getting a constant crash when saving the managedObjectContext in CoreData.
This is something that has worked flawlessly since iOS 5.
It only happens on the 64 bit version of iOS10. The 32 bit version works fine.
Here is my simple save code snip:
[self.managedObjectContext performBlockAndWait:^{
NSError *error;
if (![self.managedObjectContext save:&error])
{
NSLog(#"\n\nerror in save 1 %#\n\n", error);
}
}];
[self.managedObjectContext performBlock:^{
NSError *error;
if (![_privateWriterContext save:&error])
{
NSLog(#"\n\nerror in save 2 %#\n\n", error);
}
}];
(Above NSLog reports nothing, as it works in simulator).
This only fails on a 64bit device. I cannot replicate on the simulator. I also cannot replicate in debug on a device due to issues with my only 64 bit device not connecting to Xcode correctly. So I am a bit stuck.
Below is a sample stack trace reported from a user:
Incident Identifier: 7A8DD23B-48A2-4ABF-88E7-67F1E6CDA8D5
CrashReporter Key: 5454e7c7b99a94cd75b6adfa8334bbdf10b859eb
Hardware Model: iPhone8,1
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Date/Time: 2016-07-20 22:23:00.1429 -0400
Launch Time: 2016-07-20 22:21:30.6058 -0400
OS Version: iPhone OS 10.0 (14A5309d)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000985e4beb8
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001850e6eb0 objc_msgSend + 16
1 CoreFoundation 0x0000000185a76740 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20 (CFNotificationCenter.c:650)
2 CoreFoundation 0x0000000185a75e44 _CFXRegistrationPost + 400 (CFNotificationCenter.c:164)
3 CoreFoundation 0x0000000185a75bc0 ___CFXNotificationPost_block_invoke + 60 (CFNotificationCenter.c:1031)
4 CoreFoundation 0x0000000185ae40cc -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1504 (CFXNotificationRegistrar.m:163)
5 CoreFoundation 0x00000001859b9484 _CFXNotificationPost + 376 (CFNotificationCenter.c:1028)
6 Foundation 0x000000018644e9dc -[NSNotificationCenter postNotificationName:object:userInfo:] + 68 (NSNotification.m:482)
7 CoreData 0x0000000187e1dbf4 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postContextDidSaveNotificationWithUserInfo:] + 880 (NSManagedObjectContext.m:7381)
8 CoreData 0x0000000187dabb4c -[NSManagedObjectContext(_NSInternalAdditions) _didSaveChanges] + 2156 (NSManagedObjectContext.m:5827)
9 CoreData 0x0000000187d98570 -[NSManagedObjectContext save:] + 3440 (NSManagedObjectContext.m:1532)
10 App 0x000000010008db34 __29-[RPSAppDelegate saveContext]_block_invoke227 + 52 (RPSAppDelegate.m:338)
11 CoreData 0x0000000187e17c68 developerSubmittedBlockToNSManagedObjectContextPerform + 168 (NSManagedObjectContext.m:3529)
12 libdispatch.dylib 0x0000000185525784 _dispatch_client_callout + 16 (object.m:455)
13 libdispatch.dylib 0x000000018552a330 _dispatch_main_queue_callback_4CF + 1000 (inline_internal.h:2421)
14 CoreFoundation 0x0000000185a8a0cc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1793)
15 CoreFoundation 0x0000000185a87cb8 __CFRunLoopRun + 1660 (CFRunLoop.c:3004)
16 CoreFoundation 0x00000001859b78d8 CFRunLoopRunSpecific + 444 (CFRunLoop.c:3113)
17 GraphicsServices 0x00000001873be198 GSEventRunModal + 180 (GSEvent.c:2245)
18 UIKit 0x000000018b9617c8 -[UIApplication _run] + 664 (UIApplication.m:2651)
19 UIKit 0x000000018b95c534 UIApplicationMain + 208 (UIApplication.m:4088)
20 App 0x000000010008c138 main + 152 (main.m:27)
21 libdyld.dylib 0x00000001855585b8 start + 4
Thank you for any ideas.
You are saving _privateWriterContext in a block call of managedObjectContext. This is not allowed. The fact that it worked before is a "false positive".
Instead, you should always only use at the same context that creates the block.
Related
I am unable to reproduce the issue. One of my user sent the crash log and the issue seem to point to NSUserDefault setBool:forKey method.
Not working for user Device iPhone 6, iOS version: 12.4.4. For now only one user contacted due to the App crash.
Working on the devices I tested. (iPad Air 2, iPhone XS, iOS version 13.3)
This is the method I am using.
- (void) saveToDefaults:(NSString*)productId
{
[ [ NSUserDefaults standardUserDefaults ] setBool:YES forKey:productId ];
[ [ NSUserDefaults standardUserDefaults ] synchronize];
}
Crash dump
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000020eae32e4
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [15897]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 CoreFoundation 0x000000020eae32e4 CFHash + 372 (CFRuntime.c:1147)
1 CoreFoundation 0x000000020eb75a38 CFBasicHashFindBucket + 224 (CFBasicHash.c:465)
2 CoreFoundation 0x000000020eb75a38 CFBasicHashFindBucket + 224 (CFBasicHash.c:465)
3 CoreFoundation 0x000000020eaada40 CFDictionaryGetValue + 120 (CFDictionary.c:413)
4 CoreFoundation 0x000000020eaca938 -[CFPrefsSearchListSource alreadylocked_setPrecopiedValues:forKeys:count:from:] + 496 (CFPrefsSearchListSource.m:632)
5 CoreFoundation 0x000000020eb81230 -[CFPrefsSource setValues:forKeys:count:copyValues:removeValuesForKeys:count:from:] + 372 (CFPrefsSource.m:742)
6 CoreFoundation 0x000000020eb81524 -[CFPrefsSource setValues:forKeys:count:copyValues:from:] + 36 (CFPrefsSource.m:766)
7 CoreFoundation 0x000000020ea3e3dc -[CFPrefsSource setValue:forKey:from:] + 64 (CFPrefsSource.m:772)
8 CoreFoundation 0x000000020eaccc54 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurat... + 272 (CFPrefsSearchListSource.m:1553)
9 CoreFoundation 0x000000020eacc698 normalizeQuintuplet + 340 (CFPrefsSearchListSource.m:63)
10 CoreFoundation 0x000000020ea3ad64 -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationUR... + 108 (CFPrefsSearchListSource.m:1433)
11 CoreFoundation 0x000000020ea3dd7c -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 92 (CFXPreferences.m:759)
12 CoreFoundation 0x000000020eb8b360 _CFPreferencesSetAppValueWithContainerAndConfiguration + 132 (CFXPreferences.m:1867)
13 Foundation 0x000000020f4eb3b8 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 64 (NSUserDefaults.m:228)
14 MyApp 0x00000001004adb14 -[IAPHelper saveToDefaults:] + 88 (IAPHelper.m:206)
15 MyApp 0x00000001004adc3c -[IAPHelper restoreTransaction:] + 224 (IAPHelper.m:223)
16 MyApp 0x00000001004ad928 -[IAPHelper paymentQueue:updatedTransactions:] + 264 (IAPHelper.m:0)
17 libdispatch.dylib 0x000000020e58ca38 _dispatch_call_block_and_release + 24 (init.c:1372)
18 libdispatch.dylib 0x000000020e58d7d4 _dispatch_client_callout + 16 (object.m:511)
19 libdispatch.dylib 0x000000020e53b008 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1068 (inline_internal.h:2441)
20 CoreFoundation 0x000000020eae0b20 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1813)
21 CoreFoundation 0x000000020eadba58 __CFRunLoopRun + 1924 (CFRunLoop.c:3113)
22 CoreFoundation 0x000000020eadafb4 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
23 GraphicsServices 0x0000000210cdc79c GSEventRunModal + 104 (GSEvent.c:2245)
24 UIKitCore 0x000000023b33cc38 UIApplicationMain + 212 (UIApplication.m:4353)
25 MyApp 0x00000001004e9cec main + 88 (main.m:14)
26 libdyld.dylib 0x000000020e59e8e0 start + 4
How can I handle this exception to avoid this problem in the future.
Following up comments discussion and this answer indicating synchronize is not required (as per Apple's iOS 12 release notes):
My target iOS is from 11.2, guess I cannot use it for now.
Yes you can.
Wrapping up my suggestion in comment :
if (#available(iOS 12, *)) {
// don't need to synchronize
} else {
[NSUserDefaults.standardUserDefaults synchronize];
}
The above code #available Swift-like syntax assumes you're using Xcode 9 or higher. Which given the targeted iOS is pretty much a must.
Just to make myself 100% clear I cannot guarantee this will solve this particular crash issue, but it is worth trying as a very low effort fix candidate.
I had a user running my app on his iPhone 5. He performed a backup with iTunes. Bought a new iPhone 6S and restored from his iTunes backup.
When he launches my app it immediately crashes during launch. I got the crash logs from him, but there is no error message. It's crashing during the auto-generated -applicationDocumentsDirectory function in my AppDelegate.
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
Is there any way for me to determine what actually went wrong to see if it's something I can fix?
Incident Identifier: 3A0D56CA-EEAF-4F5A-8D16-D182E61034D5
CrashReporter Key: 9f4ce42b70e98d925f135c618394817f9451767b
Hardware Model: iPhone8,1
Process: MyApp [1198]
Path: /private/var/mobile/Containers/Bundle/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/MyApp.app/MyApp
Identifier: com.inadaydevelopment.myapp
Version: 1.0.1 (1.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2015-10-02 14:30:25.25 -0700
Launch Time: 2015-10-02 14:30:25.25 -0700
OS Version: iOS 9.0.1 (13A405)
Report Version: 105
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000019950b1e0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001995d4f0c pthread_kill + 112
2 libsystem_c.dylib 0x000000019947eb78 abort + 140
3 MyApp 0x000000010001ef7c -[AppDelegate applicationDocumentsDirectory] (AppDelegate.m:517)
4 MyApp 0x000000010001eae8 -[AppDelegate managedObjectContext] (AppDelegate.m:430)
5 MyApp 0x000000010002d004 -[BaseViewController awakeFromNib] (BaseViewController.m:54)
6 UIKit 0x00000001890e6058 -[UINib instantiateWithOwner:options:] + 2188
7 UIKit 0x0000000189324ea0 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 196
8 UIKit 0x0000000189325000 -[UIStoryboard instantiateInitialViewController] + 68
9 UIKit 0x0000000188edd178 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 108
10 UIKit 0x0000000188caee40 -[UIApplication _loadMainInterfaceFile] + 264
11 UIKit 0x0000000188edc068 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1316
12 UIKit 0x0000000188ed9300 -[UIApplication workspaceDidEndTransaction:] + 168
13 FrontBoardServices 0x000000018d7737ec -[FBSSerialQueue _performNext] + 184
14 FrontBoardServices 0x000000018d773b6c -[FBSSerialQueue _performNextFromRunLoopSource] + 56
15 CoreFoundation 0x000000018369c5a4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
16 CoreFoundation 0x000000018369c038 __CFRunLoopDoSources0 + 540
17 CoreFoundation 0x0000000183699d38 __CFRunLoopRun + 724
18 CoreFoundation 0x00000001835c8dc0 CFRunLoopRunSpecific + 384
19 UIKit 0x0000000188ca80c8 -[UIApplication _run] + 460
20 UIKit 0x0000000188ca2f60 UIApplicationMain + 204
21 MyApp 0x000000010001bdd0 main (main.m:16)
22 libdyld.dylib 0x00000001993ee8b8 start + 4
Crashes without any useful stacktrace often happen when a message is sent to a deallocated instance. I struggled with this a few weeks ago when messing around with a UIViewController category.
Of course, you are right, a message sent to nil doesn't do no harm. A message sent to a deallocated instance of sth on the other hand leads to a crash.
Try turning ZombieObjects on, then you will get a log when this occurs, which can help you find the bug.
The iOS app I am developing is having this crash with many of my users (I can catch it via PLCrashReporter library). The Exception type is SIGSEGV, so I believe is an error involving memory (like acceding a deallocated variable?).
But how can I discover what triggered it? The first line in the stacktrace involving my app is line 13:
13 ****** 0x004a9b40 _mh_execute_header +
And I really can't catch what this could mean.
Is there a way to see more info, or maybe the first four/five lines can help me more than I think?
Additional information: I use massively CoreData and NSManagedObjects, so I can't check every instance if those.
Build Version: 2.0
Incident Identifier: 5D8AECAD-3DC6-403D-8C8A-86FCC06C7FF0
Hardware Model: iPad3,3
Process: ****** [6112]
Path: /private/var/mobile/Containers/Bundle/Application/853B3A08-D893-45CA-B223-BD4A3B0241FF/******.app/******
Identifier: com.**.******
Version: 2
Code Type: ARM
Parent Process: launchd [1]
Date/Time: 2015-07-30 11:56:43 +0000
OS Version: iPhone OS 8.4 (12H143)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x7176d0c2
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x3408df66 objc_msgSend + 5
1 CoreData 0x25521bad -[NSManagedObject _clearRawPropertiesWithHint:] + 284
2 CoreData 0x25521a13 -[NSFaultHandler turnObject:intoFaultWithContext:] + 398
3 CoreData 0x2551f517 -[NSManagedObject dealloc] + 74
4 CoreData 0x2551ec25 -[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 1768
5 CoreData 0x2551e4b3 <redacted> + 326
6 CoreFoundation 0x257d026d <redacted> + 20
7 CoreFoundation 0x257cd951 <redacted> + 276
8 CoreFoundation 0x257cdd53 <redacted> + 914
9 CoreFoundation 0x257199a1 CFRunLoopRunSpecific + 476
10 CoreFoundation 0x257197b3 CFRunLoopRunInMode + 106
11 GraphicsServices 0x2d0c11a9 GSEventRunModal + 136
12 UIKit 0x28eca635 UIApplicationMain + 1440
13 ****** 0x004a9b40 _mh_execute_header + 4156224
14 libdyld.dylib 0x3464faaf <redacted> + 2
[...]
Currently I'm working with MagicalRecord v2.3.0-beta.3 commit:d18e74fe435359238b9593c03e41c1ee0baa0b78 framework. I'm getting 1 a crash log (from Crashlytics) on iPhone 5 all the time. App is still in development. The crash log looks like below:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x38eee626 objc_msgSend + 5
1 Foundation 0x2f06d02d -[NSError dealloc] + 60
2 libobjc.A.dylib 0x38ef3b6b objc_object::sidetable_release(bool) + 174
3 libobjc.A.dylib 0x38ef40d3 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 358
4 CoreFoundation 0x2e67d481 _CFAutoreleasePoolPop + 16
5 Foundation 0x2f0778e3 -[NSAutoreleasePool drain] + 122
6 CoreData 0x2e4bdfbf -[NSManagedObjectContext save:] + 942
7 MyApp 0x00162f9f __70-[NSManagedObjectContext(MagicalSaves) MR_saveWithOptions:completion:]_block_invoke15 (NSManagedObjectContext+MagicalSaves.m:82) // here app crashes
8 CoreData 0x2e5219cd developerSubmittedBlockToNSManagedObjectContextPerform + 88
9 CoreData 0x2e521b13 -[NSManagedObjectContext performBlockAndWait:] + 114
10 MyApp 0x00162e51 -[NSManagedObjectContext(MagicalSaves) MR_saveWithOptions:completion:] (NSManagedObjectContext+MagicalSaves.m:116)
11 MyApp 0x000a2b0d -[SPNCoreDataHandler parseAndSaveDictionaryReturnOperationArray:withSaving:] (SPNCoreDataHandler.m:70)
12 MyApp 0x00078f21 __102-[SPNApiHandler getAllDataWithDownloadingSuccessBlock:savingSuccessBlock:downloadStatus:failureBlock:]_block_invoke (SPNApiHandler.m:69)
13 MyApp 0x000795b9 __66-[SPNApiHandler sendGetRequestWithPath:successBlock:failureBlock:]_block_invoke (SPNApiHandler.m:174)
14 libdispatch.dylib 0x393cdd53 _dispatch_call_block_and_release + 10
15 libdispatch.dylib 0x393cdd3f _dispatch_client_callout + 22
16 libdispatch.dylib 0x393d06c3 _dispatch_main_queue_callback_4CF + 278
17 CoreFoundation 0x2e714641 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
18 CoreFoundation 0x2e712f0d __CFRunLoopRun + 1308
19 CoreFoundation 0x2e67d729 CFRunLoopRunSpecific + 524
20 CoreFoundation 0x2e67d50b CFRunLoopRunInMode + 106
21 GraphicsServices 0x335ec6d3 GSEventRunModal + 138
22 UIKit 0x30fde871 UIApplicationMain + 1136
23 MyApp 0x0009c347 main (main.m:16)
And here's code which I wrote:
NOTE: I removed some parts of this method for sake of readability (that's why method returns void instead of NSArray).
- (NSArray *)parseAndSaveDictionaryReturnOperationArray:(NSDictionary *)dictionary withSaving:(BOOL)saveSynchrounously {
[self truncateAll]; //method which removes all entries in coreData
/* methods below creates entities from array given in dictionary
using [NSManagedObject MR_createEntity] method
e.g. Contact *contact = [Contact MR_createEntity]; */
[self saveContacts:dictionary[#"contact"]];
[self savePeople:dictionary[#"person"]];
[self saveBuildings:dictionary[#"place"]];
[self saveSessions:dictionary[#"session"]];
[self saveLectures:dictionary[#"program"]];
[self savePartners:dictionary[#"partners"]];
[self saveSponsors:dictionary[#"sponsors"]];
[self saveExhibitorsPlans:dictionary[#"exhibitorplan"]];
[self saveMeetingPlans:dictionary[#"meetingplan"]];
[self saveOrganizationalInformation:dictionary[#"info"]];
[[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreAndWait];
//continue executing method...
}
I tried also to use [[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreWithCompletion:] method but it crashes too.
In other Stackoverflow question someone suggested, that crash can be caused by deleting, creating and saving to many entities at once. In my case it's around 200 deleted entities + 200 new ones. Can it cause crash?
On other devices (iPhone 4s, iPhone 5s, iPad 2, iPad4, iPad mini) it works fine. Any ideas what I'm doing wrong?
Finally I found out what was going on. Tester didn't delete and install an app as I told. Crash appears because DB schema changed. Maybe I should start to think about DB versioning during development to avoid those kind of issues.
Thanks anyone for answers.
With my App I have a pre-populated sqlite DB that I created using core data from another app I created so the Data model is the same. I copy it over and everything works great. I tried it on every iOS device that can run iOS 6.0 because that is what I am building for. Even on the early iPod Touches the App works. It takes around 45 secs for the DB to copy over on the older devices. The app works all the data is there and all devices the tests were great and no issues. I released the app on the app store and found out that on the older devices the app is crashing when it first loads. I am assuming that it is a memory related issue. I am mostly confused that the customers that purchased it that I am in communication with have the same phone an iPhone 4S and one reports it works fine while the other says it crashes. I am thinking that one has a early 4S while the other has a later 4S. I confirmed that they had room on the phone to copy the data also. When I run the app from Xcode it never crashes no matter the device.
My Question is does any one know why this is happening and a possible fix?
Maybe there is a more efficient way that doesn't make the app take almost a min to load for the first time? Any help would be great because I am at a loss. I looked at about 30 other questions that are some what like this one but they really don't answer the question I need.
I would also just like to say Thank You to all of You because I live on this site and have learned a lot from all your questions and Answers.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (_persistentStoreCoordinator != nil) {
return _persistentStoreCoordinator;
}
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:#"Data.sqlite"];
#define UPGRADE_COPY_STORE_FROM_BUNDLE
#ifdef UPGRADE_COPY_STORE_FROM_BUNDLE
if (![[NSFileManager defaultManager] fileExistsAtPath:[storeURL path]]) {
NSString *dataPath = [[NSBundle mainBundle]pathForResource:#"Data" ofType:#"sqlite" inDirectory:nil];
NSError *anyError = nil;
BOOL success = [[NSFileManager defaultManager] copyItemAtPath:dataPath toPath:[storeURL path] error:&anyError];
if (!success) NSLog(#"Error copying file: %#", anyError);
}
#endif
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
NSLog(#"Unresolved error %#, %#", error, [error userInfo]);
}
return _persistentStoreCoordinator;
}
Also attached is the Crash Log from a Device. Updated
Incident Identifier: CCFB748D-5A2A-45CE-B9EC-19811CCDC696
CrashReporter Key: 71b2c2b3b88abfe03baa87e7f588642dcec0ff08
Hardware Model: iPod4,1
Process: Upgrade [2513]
Path: /var/mobile/Applications/27C440D4-0210-48BB-A287-570FAEDE3369/Upgrade.app/Upgrade
Identifier: Upgrade
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-07-27 23:23:57.479 -0600
OS Version: iOS 6.1.2 (10B146)
Report Version: 104
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.JonPhillips.Upgrade failed to launch in time
Elapsed total CPU time (seconds): 2.450 (user 2.450, system 0.000), 12% CPU
Elapsed application CPU time (seconds): 0.528, 3% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x39b84570 read + 8
1 libcopyfile.dylib 0x39a70df4 copyfile_internal + 4616
2 libcopyfile.dylib 0x39a72196 copyfile + 3326
3 Foundation 0x32301cb4 -[NSFilesystemItemCopyOperation _handleFTSEntry:] + 384
4 Foundation 0x323014a2 -[NSDirectoryTraversalOperation main] + 334
5 Foundation 0x322af5bc -[__NSOperationInternal start] + 836
6 Foundation 0x322fdd1e -[NSFileManager copyItemAtPath:toPath:error:] + 238
7 Upgrade 0x0009f438 -[JPPAppDelegate persistentStoreCoordinator] (JPPAppDelegate.m:186)
8 Upgrade 0x0009ef30 -[JPPAppDelegate managedObjectContext] (JPPAppDelegate.m:150)
9 Upgrade 0x0009f95e -[MainScreenViewController viewDidLoad] (MainScreenViewController.m:35)
10 UIKit 0x33849590 -[UIViewController loadViewIfRequired] + 360
11 UIKit 0x338c3fb8 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 80
12 UIKit 0x338c3f5e -[UITabBarController transitionFromViewController:toViewController:] + 26
13 UIKit 0x3386e05c -[UITabBarController _setSelectedViewController:] + 292
14 UIKit 0x3386e642 -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 150
15 UIKit 0x338c6ca2 -[UITabBarController viewWillAppear:] + 130
16 UIKit 0x3389130c -[UIViewController _setViewAppearState:isAnimating:] + 132
17 UIKit 0x33849e10 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 504
18 UIKit 0x3382c40e -[UIView(Internal) _addSubview:positioned:relativeTo:] + 326
19 UIKit 0x3382c2be -[UIView(Hierarchy) addSubview:] + 26
20 UIKit 0x33889e46 -[UIWindow addRootViewControllerViewIfPossible] + 270
21 UIKit 0x33885ae8 -[UIWindow _setHidden:forced:] + 360
22 UIKit 0x338c71e4 -[UIWindow makeKeyAndVisible] + 56
23 Upgrade 0x0009e896 -[JPPAppDelegate initializeStoryBoardBasedOnScreenSize] (JPPAppDelegate.m:64)
24 Upgrade 0x0009e106 -[JPPAppDelegate application:didFinishLaunchingWithOptions:] (JPPAppDelegate.m:22)
25 UIKit 0x3388aad4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
26 UIKit 0x3388a65e -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1186
27 UIKit 0x33882846 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
28 UIKit 0x3382ac34 -[UIApplication handleEvent:withNewEvent:] + 1000
29 UIKit 0x3382a6c8 -[UIApplication sendEvent:] + 68
30 UIKit 0x3382a116 _UIApplicationHandleEvent + 6150
31 GraphicsServices 0x3551a5a0 _PurpleEventCallback + 588
32 GraphicsServices 0x3551a1ce PurpleEventCallback + 30
33 CoreFoundation 0x319f7170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
34 CoreFoundation 0x319f7112 __CFRunLoopDoSource1 + 134
35 CoreFoundation 0x319f5f94 __CFRunLoopRun + 1380
36 CoreFoundation 0x31968eb8 CFRunLoopRunSpecific + 352
37 CoreFoundation 0x31968d44 CFRunLoopRunInMode + 100
38 UIKit 0x33881480 -[UIApplication _run] + 664
39 UIKit 0x3387e2fc UIApplicationMain + 1116
40 Upgrade 0x0009e0b8 main (main.m:16)
41 libdyld.dylib 0x39accb1c start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x39b83648 kevent64 + 24
1 libdispatch.dylib 0x39abc4ec _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x39aaedf4 _dispatch_mgr_thread$VARIANT$up + 32
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x39b82eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x39b83048 mach_msg + 36
2 CoreFoundation 0x319f7040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x319f5d9e __CFRunLoopRun + 878
4 CoreFoundation 0x31968eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x31968d44 CFRunLoopRunInMode + 100
6 WebCore 0x3794c500 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x39aec30e _pthread_start + 306
8 libsystem_c.dylib 0x39aec1d4 thread_start + 4
Unknown thread crashed with unknown flavor: 5, state_count: 1
You are copying the data on the main thread, which blocks it far too long. It should never ever be blocked for 1 second or longer. Otherwise the iOS watchdog will kill your process.
The specific crash report shows the app was killed, because it took too long to start up: com.JonPhillips.Upgrade failed to launch in time.
The copy action is even running from inside applicationDidFinishLaunching. The watchdog timer is even shorter for having this method end! Check the WWDC sessions for exact timing if you are interested in them. I don't recall in which specifically it was mentioned.
If you require such tasks, move them to a background thread. If this tasks means that the user cannot do anything in the app, show a specific UI telling the user what is going on and giving some indication how long it will take, e.g. a progress bar, and/or some text "Step 1 of 3: Copying data".