- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在尝试执行 NSBatchUpdateRequest 时不断收到以下错误。
*** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Unknown command type
<NSBatchUpdateRequest : entity = Person, properties = {
"(<NSAttributeDescription: 0x6000000ff980>), name title, isOptional 1, isTransient 0, entity (null), renamingIdentifier title, validation predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700 , attributeValueClassName NSString, defaultValue (null)" = "\"sometitle\"";
}, subentities = 1'
当在构造函数中正确指定时,错误日志显示“entity (null)”。
我正在运行这是一个测试环境,想知道 NSBatchUpdateRequest 是否支持带有 NSInMemoryStoreType 的 NSPersistentStoreCoordinator。我在文档中找不到任何说它不受支持的内容。
下面是我使用的代码。实体和属性参数正确,不应引起问题。
-(BOOL) updatePersonNamesFrom:(NSString*)oldName newName:(NSString*)newName {
NSBatchUpdateRequest* updateRequest = [[NSBatchUpdateRequest alloc] initWithEntityName:@"Person"]; // The person model definitely exists
NSLog(@"entity name: %@", updateRequest.entityName); // This logs the correct entity name
// Adding or removing a predicate has no effect
// [updateRequest setPredicate:[NSPredicate predicateWithFormat:@"name = %@", oldName];
updateRequest.propertiesToUpdate = @{@"name" : newName}; // Name field definitely exists on Person
NSError* error = nil;
[m_context executeRequest:updateRequest error:&error];
// Also tried this
// [m_context.persistentStoreCoordinator executeRequest:updateRequest withContext:self error:&error];
return error != nil;
}
如果有人有任何想法,我很想听听。
最佳答案
来自guide :
Important: Batch updates are only available when you are using a SQLite persistent store.
对不起。也许它会在 iOS 11 中工作。¯\_(ツ)_/¯
关于ios - NSBatchUpdateRequest 抛出 NSInternalInconsistencyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43269081/
我正在尝试使用 NSBatchUpdateRequest 来更新一对多关系。 我的实体Presentation有多个Slide,是另一个实体,它们是反比关系。 当我尝试更新幻灯片时,出现此错误: **
我在尝试执行 NSBatchUpdateRequest 时不断收到以下错误。 *** Terminating app due to uncaught exception 'NSInternalInco
目前,我通过以下代码执行多个更新操作。 func updateOrders(_ updates : [(objectID: NSManagedObjectID, order: Int64)]) {
我正在学习 Swift 的同时构建一个博客阅读器。在此,我将数据保存到核心数据,并可以选择将文章标记为“已读”。当我使用 editActionsForRowsAtIndexPath 将它们单独标记为已
长话短说 显然,当通过执行 NSBatchUpdateRequest 发生更改时,NSFetchedResultsController 不知道给定 NSManagedObjectContext 上的数
这是我的NSBatchUpdateRequest: let batchUpdateRequest = NSBatchUpdateRequest(entityName: "WLItem")
是否可以使用 NSBatchUpdateRequest 将属性设置为 nil?将 NSNull() 传递给 propertiesToUpdate 无效: let unlockRequest = NSB
我创建了简单的 NSBatchUpdateRequest: let bur = NSBatchUpdateRequest(entityName: "WLWishlist") bur.predicate
我得到了一个 NSFetchedResultsController,它是我使用 NSManagedObjectContext 设置的。我使用此上下文执行提取。 我还有一个 NSBatchUpdateR
是否可以使用NSBatchUpdateRequest将属性设置为nil?将NSNull()传递给PropertiesToUpdate不起作用:。我没有收到任何错误,但它没有清除日期。。我还尝试将其设置
我是一名优秀的程序员,十分优秀!