【发布时间】:2018-04-18 15:47:49
【问题描述】:
我正在使用两个键 NSPersistentStoreUbiquitousContentNameKey 和 NSPersistentStoreUbiquitousContentURLKey 来指定持久存储在普遍存在中具有给定的名称和 URL。 但是这个键在 iOS 10.0 中被弃用了。因此需要使用备用 api 删除这个已弃用的 api。
-(NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
//Return if the persistance store exists.
if (__persistentStoreCoordinator != nil) {
return __persistentStoreCoordinator;
}
__persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]];
NSPersistentStoreCoordinator *psc = __persistentStoreCoordinator;
NSMutableDictionary *options = [NSMutableDictionary dictionary];
[options setObject:iCloudEnabledAppID forKey:NSPersistentStoreUbiquitousContentNameKey];
[options setObject:iCloudLogsPath forKey:NSPersistentStoreUbiquitousContentURLKey];
[options setObject:NSFileProtectionComplete forKey:NSPersistentStoreFileProtectionKey];
[psc lock];
return __persistentStoreCoordinator;
}
我浏览了 iOS 10.0 的发行说明,但没有找到任何解决方法。 这些键有替代品吗?
【问题讨论】:
标签: ios objective-c core-data ios10 icloud