我有一个连接到FRC(Fetched Results Controller)的tableView,我也有两个上下文,即在私有队列中初始化的backgroundContext和在主队列上初始化的mainContext。我还设置了didSaveNotification来将对象从一个上下文传递到另一个上下文。当我在backgroundContext中保存一些数据时,它会成功保存并且FRC更新,但如果我再次重复该过程,则应用程序崩溃并显示错误
'ALL或ANY运算符的左侧必须是a NSArray或NSSet。'
保存是通过以模态方式呈现的表单完成的。如果在其他viewControllers中呈现,则相同的viewController工作正常。但只在一个特定的一个崩溃。但是,除了提交表格之外没有其他额外的东西正在进行中。
这是我的整个崩溃报告。
由于未捕获的异常而终止应用 'NSInvalidArgumentException',原因:'ALL的左侧 或者任何运算符必须是NSArray或NSSet。 * 第一次抛出调用堆栈:(0 CoreFoundation 0x0000000103575495 exceptionPreprocess + 165 1 libobjc.A.dylib
0x0000000102fbb99e objc_exception_throw + 43 2基金会 0x00000001003c706b - [NSPredicateOperator performOperationUsingObject:andObject:] + 826 3基础
0x00000001003c6c1e - [NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 314 4基础
0x00000001003c6ae2 - [NSPredicate evaluateWithObject:] + 19 5
CoreData 0x0000000102d61d06 - [NSFetchedResultsController(PrivateMethods)_objectInResults:] + 102 6 CoreData 0x0000000102d630f7 - [NSFetchedResultsController(PrivateMethods)_preprocessUpdatedObjects:insertsInfo:deletesInfo:updatesInfo:sectionsWithDeletes:newSectionNames:treatAsRefreshes:] + 519 7 CoreData 0x0000000102d642d5 - [NSFetchedResultsController(PrivateMethods)_managedObjectContextDidChange:] + 1781 8 CoreFoundation 0x00000001035cad9c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12 9 CoreFoundation 0x000000010352d51d _CFXNotificationPost + 2381 10 Foundation 0x000000010035b7fa - [NSNotificationCenter postNotificationName:object:userInfo:] + 68 11 CoreData
0x0000000102c9048a - [NSManagedObjectContext(_NSInternalNotificationHandling)_postObjectsDidChangeNotificationWithUserInfo:] + 74 12 CoreData 0x0000000102d16c8b - [NSManagedObjectContext(_NSInternalChangeProcessing)_createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 331 13 CoreData 0x0000000102c8c9cc - [NSManagedObjectContext(_NSInternalChangeProcessing)_postRefreshedObjectsNotificationAndClearList] + 108 14 CoreData 0x0000000102c8c5e4 - [NSManagedObjectContext(_NSInternalChangeProcessing)_processRecentChanges:] + 2804 15 CoreData 0x0000000102c663cb _performRunLoopAction + 267 16 CoreFoundation
0x0000000103540dc7 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 17 CoreFoundation 0x0000000103540d37 __CFRunLoopDoObservers + 391 18 CoreFoundation 0x0000000103520522 __CFRunLoopRun + 946 19 CoreFoundation
0x000000010351fd83 CFRunLoopRunSpecific + 467 20图形服务
0x00000001037ecf04 GSEventRunModal + 161 21 UIKit
0x00000001011bde33 UIApplicationMain + 1010 22 Expense_Manager
0x0000000100001d13 main + 115 23 libdyld.dylib
0x000000010420c7e1 start + 0)libc ++ abi.dylib:终止于 NSException类型的未捕获异常
提前致谢。
答案 0 :(得分:0)
好的,我实际上发现了为什么会在几天前发生这种情况。当表单被解除时,有一个通知被触发,该表单从另一个连接到共享相同上下文的FRC的viewController重新加载了一个tableView。一旦我在viewDidDisappear中以观察者身份移除它,它就不会崩溃。 :)我希望这有助于让某人面临同样的问题。