Warum stürzt die App ab, wenn eine vorab gefüllte Datenbank beim ersten Öffnen auf älteren Geräten in Core Data geladen wird?

Mit meiner App habe ich eine vorab ausgefüllte SQLite-Datenbank, die ich mit Kerndaten einer anderen von mir erstellten App erstellt habe, damit das Datenmodell identisch ist. Ich kopiere es über und alles funktioniert super. Ich habe es auf jedem iOS-Gerät ausprobiert, auf dem iOS 6.0 ausgeführt werden kann, da ich dafür erstelle. Auch auf dem frühen iPod Touch funktioniert die App. Es dauert ungefähr 45 Sekunden, bis die Datenbank auf den älteren Geräten kopiert ist. Die App funktioniert alle Daten sind da und alle Geräte die Tests waren super und keine Probleme. Ich habe die App im App Store veröffentlicht und festgestellt, dass die App auf den älteren Geräten beim ersten Laden abstürzt. Ich gehe davon aus, dass es sich um ein Speicherproblem handelt. Ich bin größtenteils verwirrt, dass die Kunden, die es gekauft haben und mit denen ich kommuniziere, dasselbe Telefon und dasselbe iPhone 4S haben und eines meldet, dass es funktioniert, während das andere sagt, dass es abstürzt. Ich denke, dass einer eine frühe 4S hat, während der andere eine spätere 4S hat. Ich bestätigte, dass sie am Telefon Platz hatten, um die Daten auch zu kopieren. Wenn ich die App von Xcode aus starte, stürzt sie unabhängig vom Gerät nie ab.

Meine Frage ist, weiß jemand, warum dies geschieht und eine mögliche Lösung?

Vielleicht gibt es eine effizientere Methode, mit der das Laden der App zum ersten Mal fast eine Minute dauert? Jede Hilfe wäre toll, weil ich ratlos bin. Ich habe mir ungefähr 30 andere Fragen angeschaut, die einige davon sind, aber die Frage, die ich brauche, beantworten sie wirklich nicht.

Ich möchte mich auch nur bei Ihnen allen bedanken, weil ich auf dieser Seite lebe und aus all Ihren Fragen und Antworten viel gelernt habe.

- (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;
}

Ebenfalls angehängt ist das Absturzprotokoll von einem Gerät. Aktualisierte

    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

Antworten auf die Frage(1)

Ihre Antwort auf die Frage