OfficeDev/skype-ios-app-sdk-samples

SkypeForBusiness.framework addPersistentStoreWithType method of NSPersistentStoreCoordinator returning nil in iOS 10

Closed this issue · 1 comments

I am using SkypeForBusiness.framework for my App, now after updating my ipad 4 to iOS 10 the addPersistentStoreWithType method of NSPersistentStoreCoordinator returning nil when i run the same code on my ipad 3 with iOS 9.3.5 it returning a object

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

I finally found the fix to the problem

click here