我的应用程序崩溃的核心数据有问题。当我尝试将对象添加到关系时会发生这种情况。
HOMUser *artist = [HOMUser GetUserWithDictionary:artistDict inContext:context];
[self addMArtistsObject:artist];
* 由于未捕获的异常“NSRangeException”而终止应用程序,原因:“* -[__NSArrayM objectAtIndex:]: index 25 beyond bounds [0 .. 24]”
数字 25 表示核心数据模型中有多少实体。这是调用堆栈。它深入到框架中,所以我不能调试很多。这从来没有发生过。我已经检查并重新检查了核心数据模型。有人知道什么是错的吗?
0 CoreFoundation 0x02c0e02e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x02a33e7e objc_exception_throw + 44
2 CoreFoundation 0x02bb00b4 -[__NSArrayM objectAtIndex:] + 196
3 CoreData 0x0122ee2a -[NSManagedObject(_NSInternalMethods) _includeObject:intoPropertyWithKey:andIndex:] + 90
4 CoreData 0x0122ed0e -[NSManagedObject(_NSInternalMethods) _maintainInverseRelationship:forProperty:oldDestination:newDestination:] + 590
5 CoreData 0x0122fcb1 -[NSManagedObject(_NSInternalMethods) _maintainInverseRelationship:forProperty:forChange:onSet:] + 273
6 CoreData 0x0122e956 -[NSManagedObject(_NSInternalMethods) _didChangeValue:forRelationship:named:withInverse:] + 1878
7 CoreData 0x0122e1f0 -[NSManagedObjectContext observeValueForKeyPath:ofObject:change:context:] + 400
8 Foundation 0x021a6ce7 NSKeyValueNotifyObserver + 357
9 Foundation 0x021c03f4 NSKeyValueDidChange + 456
10 Foundation 0x022239c3 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:withSetMutation:usingObjects:] + 131
11 CoreData 0x0122fb58 _PF_ManagedObject_DidChangeValueForKeywithSetMutation + 72
12 CoreData 0x012a77e6 _sharedIMPL_addObjectToSet_core + 310
13 ??? 0x0bcf1379 0x0 + 198120313
14 Product Name 0x000acb39 -[HOMEvent initWithTitle:withArtist:withPlace:withWhen:withDescription:andWithOptionsLink:andWithLinkWith:andWithFriends:insertIntoContext:] + 1161
15 Product Name 0x002315a3 -[HOMAddEventVCViewController postPressed:] + 8771
16 libobjc.A.dylib 0x02a47705 -[NSObject performSelector:withObject:withObject:] + 77
17 UIKit 0x016b7920 -[UIApplication sendAction:to:from:forEvent:] + 96
18 UIKit 0x016b78b8 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
19 UIKit 0x01778671 -[UIControl sendAction:to:forEvent:] + 66
20 UIKit 0x01778bcf -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578
21 UIKit 0x01777d38 -[UIControl touchesEnded:withEvent:] + 546
22 UIKit 0x0197b213 _UIGestureRecognizerUpdate + 7407
23 CoreFoundation 0x02bd6afe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x02bd6a3d __CFRunLoopDoObservers + 381
25 CoreFoundation 0x02bb47c2 __CFRunLoopRun + 1106
26 CoreFoundation 0x02bb3f44 CFRunLoopRunSpecific + 276
27 CoreFoundation 0x02bb3e1b CFRunLoopRunInMode + 123
28 GraphicsServices 0x038247e3 GSEventRunModal + 88
29 GraphicsServices 0x03824668 GSEventRun + 104
30 UIKit 0x016b465c UIApplicationMain + 1211