设置 CDEPersistentStoreEnsemble 给出 [NSMapTable cde_strongToStrongObjectsMapTable]:
Setting up CDEPersistentStoreEnsemble gives [NSMapTable cde_strongToStrongObjectsMapTable]:
我正在设置整体以将 CoreData 同步到 iCloud。
但它在启动时崩溃:
[NSMapTable cde_strongToStrongObjectsMapTable]: 无法识别的选择器发送到 class 0x10d978c70
2016-08-05 12:48:42.502 Shooters_Journal[30266:751831] *** 由于未捕获的异常 'NSInvalidArgumentException' 而终止应用程序,原因:'+[NSMapTable cde_strongToStrongObjectsMapTable]:无法识别的选择器发送到 class 0x10d978c70'
我不明白这是什么意思。我该如何进行调试??
我已经添加了我的 CoreData Stack 和 Ensembles 设置。作为记录,该应用程序在不设置合奏的情况下运行良好。
在我的 AppDelegate 中,我有:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// setups
// Setup Ensemble
let modelURL = NSBundle.mainBundle().URLForResource("Myidentifier", withExtension: "momd")
cloudFileSystem = CDEICloudFileSystem(ubiquityContainerIdentifier: nil)
let storeURL = self.applicationDocumentsDirectory.URLByAppendingPathComponent("CoreData.sqlite")
ensemble = CDEPersistentStoreEnsemble(ensembleIdentifier: "ShotsStore", persistentStoreURL: storeURL, managedObjectModelURL: modelURL!, cloudFileSystem: cloudFileSystem)
ensemble.delegate = self
return true
}
我的CoreData栈是默认XCode创建的
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1]
}()
lazy var managedObjectModel: NSManagedObjectModel = {
let modelURL = NSBundle.mainBundle().URLForResource("Myidentifier", withExtension: "momd")
return NSManagedObjectModel(contentsOfURL: modelURL!)!
}()
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
// Create the coordinator and store
let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let storeUrl = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SingleViewCoreData.sqlite")
var failureReason = "There was an error creating or loading the application's saved data."
do {
try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: storeUrl, options: nil)
} catch {
// Report any error we got.
var dict = [String: AnyObject]()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason
dict[NSUnderlyingErrorKey] = error as NSError
let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)")
abort()
}
return coordinator
}()
lazy var managedObjectContext: NSManagedObjectContext = {
let coordinator = self.persistentStoreCoordinator
var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()
该应用程序编译正常,但在启动时出现以下错误:
[NSMapTable cde_strongToStrongObjectsMapTable]: unrecognized selector
sent to class 0x10d978c70
我现在只有那一行:
ensemble = CDEPersistentStoreEnsemble(ensembleIdentifier: "ShotsStore", persistentStoreURL: storeURL, managedObjectModelURL: modelURL!, cloudFileSystem: cloudFileSystem)
导致崩溃。
我不知道错误是 persistentStoreURL、managedObjectModelURL 还是 cloudFileSystem。
我想你忘记了 README 中的 -ObjC 步骤。这将导致链接所有类别,从而导致缺少符号错误。
我正在设置整体以将 CoreData 同步到 iCloud。 但它在启动时崩溃: [NSMapTable cde_strongToStrongObjectsMapTable]: 无法识别的选择器发送到 class 0x10d978c70 2016-08-05 12:48:42.502 Shooters_Journal[30266:751831] *** 由于未捕获的异常 'NSInvalidArgumentException' 而终止应用程序,原因:'+[NSMapTable cde_strongToStrongObjectsMapTable]:无法识别的选择器发送到 class 0x10d978c70'
我不明白这是什么意思。我该如何进行调试?? 我已经添加了我的 CoreData Stack 和 Ensembles 设置。作为记录,该应用程序在不设置合奏的情况下运行良好。 在我的 AppDelegate 中,我有:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// setups
// Setup Ensemble
let modelURL = NSBundle.mainBundle().URLForResource("Myidentifier", withExtension: "momd")
cloudFileSystem = CDEICloudFileSystem(ubiquityContainerIdentifier: nil)
let storeURL = self.applicationDocumentsDirectory.URLByAppendingPathComponent("CoreData.sqlite")
ensemble = CDEPersistentStoreEnsemble(ensembleIdentifier: "ShotsStore", persistentStoreURL: storeURL, managedObjectModelURL: modelURL!, cloudFileSystem: cloudFileSystem)
ensemble.delegate = self
return true
}
我的CoreData栈是默认XCode创建的
// MARK: - Core Data stack
lazy var applicationDocumentsDirectory: NSURL = {
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
return urls[urls.count-1]
}()
lazy var managedObjectModel: NSManagedObjectModel = {
let modelURL = NSBundle.mainBundle().URLForResource("Myidentifier", withExtension: "momd")
return NSManagedObjectModel(contentsOfURL: modelURL!)!
}()
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator = {
// Create the coordinator and store
let coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let storeUrl = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SingleViewCoreData.sqlite")
var failureReason = "There was an error creating or loading the application's saved data."
do {
try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: storeUrl, options: nil)
} catch {
// Report any error we got.
var dict = [String: AnyObject]()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason
dict[NSUnderlyingErrorKey] = error as NSError
let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
NSLog("Unresolved error \(wrappedError), \(wrappedError.userInfo)")
abort()
}
return coordinator
}()
lazy var managedObjectContext: NSManagedObjectContext = {
let coordinator = self.persistentStoreCoordinator
var managedObjectContext = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()
该应用程序编译正常,但在启动时出现以下错误:
[NSMapTable cde_strongToStrongObjectsMapTable]: unrecognized selector sent to class 0x10d978c70
我现在只有那一行:
ensemble = CDEPersistentStoreEnsemble(ensembleIdentifier: "ShotsStore", persistentStoreURL: storeURL, managedObjectModelURL: modelURL!, cloudFileSystem: cloudFileSystem)
导致崩溃。 我不知道错误是 persistentStoreURL、managedObjectModelURL 还是 cloudFileSystem。
我想你忘记了 README 中的 -ObjC 步骤。这将导致链接所有类别,从而导致缺少符号错误。