我有一个应用程序可以在application:didFinishLaunchingWithOptions
. 添加商店显然需要很长时间,这会导致 iOS 在应用程序完成启动之前终止它。超时时的堆栈跟踪如下所示。有谁知道如何防止这种情况发生?
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.foo.bar failed to launch in time
Elapsed total CPU time (seconds): 23.490 (user 23.490, system 0.000), 78% CPU
Elapsed application CPU time (seconds): 8.406, 28% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x31b8939c pread + 20
1 libsqlite3.dylib 0x31ed95d0 unixRead
2 libsqlite3.dylib 0x31eec106 readDbPage
3 libsqlite3.dylib 0x31eeb2a2 sqlite3PagerAcquire
4 libsqlite3.dylib 0x31f04096 moveToChild
5 libsqlite3.dylib 0x31f052c6 sqlite3BtreeNext
6 libsqlite3.dylib 0x31f01490 sqlite3VdbeExec
7 libsqlite3.dylib 0x31efa48a sqlite3_step
8 CoreData 0x364f8892 _execute
9 CoreData 0x364f878c -[NSSQLiteConnection execute]
10 CoreData 0x3658bd94 -[NSSQLConnection prepareAndExecuteSQLStatement:]
11 CoreData 0x365dd4f2 -[_NSSQLiteStoreMigrator performMigration:]
12 CoreData 0x365d70dc -[NSSQLiteInPlaceMigrationManager migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:]
13 CoreData 0x36577428 -[NSMigrationManager migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:]
14 CoreData 0x365c8670 -[NSStoreMigrationPolicy(InternalMethods) migrateStoreAtURL:toURL:storeType:options:withManager:error:]
15 CoreData 0x365c79c4 -[NSStoreMigrationPolicy migrateStoreAtURL:withManager:metadata:options:error:]
16 CoreData 0x365c8ece -[NSStoreMigrationPolicy(InternalMethods) _gatherDataAndPerformMigration:]
17 CoreData 0x364ec3b0 -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]