私は今、私は同じコードを実行するとはnilを返すのiOS 10にNSPersistentStoreCoordinatorのaddPersistentStoreWithType方法を私のiPad 4を更新した後、私のアプリのためSkypeForBusiness.frameworkを使用していますiOSのと私のiPad 3は、私は最終的に問題SkypeForBusiness.framework addPersistentStoreWithType方法
に修正を見つけ、それが
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
static NSPersistentStoreCoordinator *coordinator = nil;
static dispatch_once_t token;
dispatch_once(&token, ^{
// get the model
NSManagedObjectModel *model = [NSManagedObjectModel mergedModelFromBundles:nil];
// get the coordinator
coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];
// add store
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *applicationSupportURL = [[fileManager URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject];
[fileManager createDirectoryAtURL:applicationSupportURL withIntermediateDirectories:NO attributes:nil error:nil];
NSURL *databaseURL = [applicationSupportURL URLByAppendingPathComponent:@"database_name.sqlite"];
NSError *error = nil;
// [[NSFileManager defaultManager] removeItemAtURL:databaseURL error:&error];
NSDictionary *options = @{
EncryptedStorePassphraseKey : @"********",
// EncryptedStoreDatabaseLocation : databaseURL,
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES
};
NSPersistentStore *store = [coordinator
addPersistentStoreWithType:EncryptedStoreType
configuration:nil
URL:databaseURL
options:options
error:&error];
// coordinator = [EncryptedStore makeStoreWithOptions:options managedObjectModel:model];
NSAssert(store, @"Unable to add persistent store!\n%@", error);
});
return coordinator;
}