Persistent Store 在大量迁移中找不到迁移策略类
Posted
技术标签:
【中文标题】Persistent Store 在大量迁移中找不到迁移策略类【英文标题】:Persistent Store can't find migration policy class in heavy migration 【发布时间】:2015-12-29 08:21:10 【问题描述】:我收到此错误:
2015-12-29 03:13:41.603 n-back project[21345:474175] CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/Nathan/Library/Developer/CoreSimulator/Devices/EC2C60E2-9FC8-40D7-B16F-15960AA6B42A/data/Containers/Data/Application/8F8132B0-76E9-491E-BA1B-27A5D78CE7D0/Documents/data.sqlite options:
NSMigratePersistentStoresAutomaticallyOption = 1;
... returned error Error Domain=NSCocoaErrorDomain Code=134110 "(null)" UserInfo=NSUnderlyingException=Couldn't create mapping policy for class named (BTRPolicy) with userInfo dictionary
NSUnderlyingException = "Couldn't create mapping policy for class named (BTRPolicy)";
2015-12-29 03:13:41.608 n-back project[21345:474175] Unresolved error Error Domain=YOUR_ERROR_DOMAIN Code=9999 "Failed to initialize the application's saved data" UserInfo=NSLocalizedDescription=Failed to initialize the application's saved data, NSUnderlyingError=0x7b14eef0 Error Domain=NSCocoaErrorDomain Code=134110 "(null)" UserInfo=NSUnderlyingException=Couldn't create mapping policy for class named (BTRPolicy), NSLocalizedFailureReason=There was an error creating or loading the application's saved data., [NSLocalizedDescription: Failed to initialize the application's saved data, NSUnderlyingError: Error Domain=NSCocoaErrorDomain Code=134110 "(null)" UserInfo=NSUnderlyingException=Couldn't create mapping policy for class named (BTRPolicy), NSLocalizedFailureReason: There was an error creating or loading the application's saved data.]
在我看来,它在查找 BTRPolicy 类时遇到了问题。它存在于名为 BTRPolicy 的文件 BTRPolicy 中。它在实用程序窗格的自定义策略选择中被正确地分类并引用为“BTRPolicy”。有什么想法吗?
【问题讨论】:
【参考方案1】:如果其他人有这个问题并且这与您的谷歌搜索匹配:我想通了,由于某种原因,自定义策略现在需要以模块名称作为前缀。
【讨论】:
是只适用于 Swift 还是也适用于 Objective-C? 仅适用于 Swift。以上是关于Persistent Store 在大量迁移中找不到迁移策略类的主要内容,如果未能解决你的问题,请参考以下文章
MinGW gcc 在 /local/include 中找不到头文件
maven-shade-plugin 错误:在“资源”的 org.apache.maven.plugins.shade.resource.ManifestResourceTransformer 中找不