Core data 核心数据保存异常NSInvalidArgumentException

Core data 核心数据保存异常NSInvalidArgumentException,core-data,nsmanagedobjectcontext,Core Data,Nsmanagedobjectcontext,这个错误很奇怪,因为它发生在程序运行时的某些点上。保存上下文大约30次后,程序崩溃 你能帮我指出我的错误吗?谢谢 -[NSCFNumber UTF8String]: unrecognized selector sent to instance 0x5a627f0 2011-05-19 17:17:38.650 DMC to Go[16892:40b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException

这个错误很奇怪,因为它发生在程序运行时的某些点上。保存上下文大约30次后,程序崩溃

你能帮我指出我的错误吗?谢谢

-[NSCFNumber UTF8String]: unrecognized selector sent to instance 0x5a627f0 2011-05-19 17:17:38.650 DMC to Go[16892:40b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber UTF8String]: unrecognized selector sent to instance 0x5a627f0' *** Call stack at first throw: ( 0 CoreFoundation 0x015d95a9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0172d313 objc_exception_throw + 44 2 CoreFoundation 0x015db0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x0154a966 ___forwarding___ + 966 4 CoreFoundation 0x0154a522 _CF_forwarding_prep_0 + 50 5 CoreData 0x002f970f -[NSSQLiteConnection execute] + 1231 6 CoreData 0x0034bebd -[NSSQLiteConnection updateRow:] + 365 7 CoreData 0x0034ae64 -[NSSQLConnection performAdapterOperations:] + 180 8 CoreData 0x0034ab0e -[NSSQLCore _performChangesWithAdapterOps:] + 494 9 CoreData 0x003495ea -[NSSQLCore performChanges] + 410 10 CoreData 0x00343038 -[NSSQLCore saveChanges:] + 216 11 CoreData 0x00301199 -[NSSQLCore executeRequest:withContext:error:] + 409 12 CoreData 0x003b170b -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 3691 13 CoreData 0x00339948 -[NSManagedObjectContext save:] + 712 14 DMC to Go 0x00002f9b -[dmcIpadAppDelegate saveManagedObjectChanges] + 107 15 DMC to Go 0x00020c25 +[DmcIpadAppDelegate saveManagedObjectChanges] + 117 16 DMC to Go 0x000276e3 -[DownloadFileService observeValueForKeyPath:ofObject:change:context:] + 867 17 Foundation 0x00faf1e4 NSKeyValueNotifyObserver + 361 18 Foundation 0x00faeca6 NSKeyValueDidChange + 384 19 Foundation 0x00f953e2 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 123 20 DMC to Go 0x0002c4d4 -[DownloadManager connectionDidFinishLoading:] + 836 21 Foundation 0x00fd5112 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108 22 Foundation 0x00fd506b _NSURLConnectionDidFinishLoading + 133 23 CFNetwork 0x01dda48e _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 220 24 CFNetwork 0x01ea56e1 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 293 25 CFNetwork 0x01dd0c80 _ZN19URLConnectionClient13processEventsEv + 100 26 CFNetwork 0x01dd0acf _ZN17MultiplexerSource7performEv + 251 27 CoreFoundation 0x015ba8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 28 CoreFoundation 0x0151888b __CFRunLoopDoSources0 + 571 29 CoreFoundation 0x01517d86 __CFRunLoopRun + 470 30 CoreFoundation 0x01517840 CFRunLoopRunSpecific + 208 31 CoreFoundation 0x01517761 CFRunLoopRunInMode + 97 32 GraphicsServices 0x0202b1c4 GSEventRunModal + 217 33 GraphicsServices 0x0202b289 GSEventRun + 115 34 UIKit 0x00839c93 UIApplicationMain + 1160 35 DMC to Go 0x00001db9 main + 121 36 DMC to Go 0x00001d35 start + 53 37 ??? 0x00000001 0x0 + 1 ) terminate called after throwing an instance of 'NSException' Current language: auto; currently objective-c kill quit -[NSCFNumber UTF8String]:发送到实例0x5a627f0的选择器无法识别 2011-05-19 17:17:38.650 DMC将继续[16892:40b]***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[NSCFNumber UTF8String]:未识别的选择器发送到实例0x5a627f0' ***第一次抛出时调用堆栈: ( 0 CoreFoundation 0x015 D95A9例外预处理+185 1 libobjc.A.dylib 0x0172d313 objc_异常_抛出+44 2 CoreFoundation 0x015db0bb-[NSObject(NSObject)不识别选择器:+187 3 CoreFoundation 0x0154a966_____;u+966 4 CoreFoundation 0x0154a522\u CF\u转发\u准备\u 0+50 5 CoreData 0x002f970f-[NSSQLiteConnection执行]+1231 6 CoreData 0x0034bebd-[NSSQLiteConnection updateRow:+365 7 CoreData 0x0034ae64-[NSSQLConnection performAdapterOperations:+180 8 CoreData 0x0034ab0e-[NSSQLCore性能变化与自适应运算:+494 9 CoreData 0x003495ea-[NSSQLCore性能更改]+410 10 CoreData 0x00343038-[NSSQLCore saveChanges::+216 11 CoreData 0x00301199-[NSSQLCore executeRequest:withContext:error:+409 12 CoreData 0x003b170b-[NSPersistentStoreCoordinator executeRequest:withContext:error:+3691 13核心数据0x00339948-[NSManagedObjectContext保存:][712 14 DMC转到0x00002f9b-[dmcIpadAppDelegate saveManagedObjectChanges]+107 15 DMC转到0x00020c25+[DmcIpadAppDelegate saveManagedObjectChanges]+117 16 DMC转到0x000276e3-[DownloadFileService观察值ForkeyPath:ofObject:change:context:+867 17基金会0x00 FAF1E4 NKEY ValueOnEdvyVistor + 361 18基金会0x00 FAECA6 NKY ValueDeDechange + 384 19基金会0x00 F953E2- [ NSbObjs](NKKEY ValueBoServEngress)DeDeCudioRealEffy:KE:+ 123 20 DMC转到0x0002c4d4-[下载管理器连接IDFinishLoading:][836 21基金会0x00 FD5612- [ nSurLink(NSURLCnRealRealEngin)sDeDeDeFixSimule] + 108 22基金会0x00 FD506B NoSnLink连接FixIsHead + 133 23 CFNetwork 0x01dda48e\u zn19URLConnectionClient 23\u客户端完成加载EPNS\u 26客户端连接ventqueue+220 24 CFNetwork 0x01ea56e1_zn19; URLConnectionClient 26客户端连接EventQuee33处理所有事件和消费有效负载EP20X连接事件信息12客户端事件18客户端事件队列+293 25 CFNetwork 0x01dd0c80\u ZN19URLConnectionClient 13进程事件Sev+100 26 CFNetwork 0x01dd0acf_ZN17多路复用器资源7性能+251 27 CoreFoundation 0x015ba8ff\uuu CFRUNLOOP\u正在调用\uu OUT\uu至\uu源0\u执行功能\uuuu+15 28 CoreFoundation 0x0151888b u CFRunLoopDoSources0+571 29 CoreFoundation 0x01517d86 _ucfrunlooprun+470 30 CoreFoundation 0x01517840 CFRunLoopRunSpecific+208 31 CoreFoundation 0x01517761 CFRUNLOOPSRUNINMODE+97 32图形服务0x0202b1c4 GSEventRunModal+217 33图形服务0x0202b289 GSEventRun+115 34 UIKit 0x00839c93 UIApplicationMain+1160 35 DMC至0x00001db9干管+121 36 DMC至0x00001d35启动+53 37°?0x00000001 0x0+1 ) 在抛出“NSException”实例后调用terminate 当前语言:自动;当前目标-c 杀死 退出
从异常信息中,您似乎试图从NSNumber中提取NSString信息。您可能希望查看此Q/A以获取故障排除方面的帮助:

有些东西希望NSNumber对象是NSString对象。我的猜测是,模型中有一个具有string属性的实体,但与模型中该实体对应的NSManagedObject的子类有一个NSNumber属性。可能模型已更改,并且关联的类定义不同步。也许它是一个可选属性,对于大多数对象来说是空的,当它最终被使用时,三十次保存到应用程序的运行中,它会触发这个异常