
这是堆栈跟踪:
Thread : Fatal Exception: NSInternalinconsistencyException0 CoreFoundation 0x30080e83 __exceptionPreprocess + 1301 libobjc.A.dylib 0x3a3dd6c7 objc_exception_throw + 382 CoreData 0x2fdcf941 -[NSsqliteStatement cachedsqliteStatement]3 CoreData 0x2fdcf18d -[NSsqliteConnection preparesqlStatement:] + 524 CoreData 0x2fde8edf -[NSsqlChannel selectRowsWithCachedStatement:] + 585 CoreData 0x2fea8e1f newFetchedRowsForFetchPlan_MT + 9106 CoreData 0x2fde8949 -[NSsqlCore fetchRowForObjectID:] + 11807 CoreData 0x2fde8311 -[NSsqlCore newValuesForObjectWithID:withContext:error:] + 2568 CoreData 0x2fde762b _PFFaultHandlerLookupRow + 3989 CoreData 0x2fde7193 _PF_FulfillDeferredFault + 21810 CoreData 0x2fdf6449 _PF_Managedobject_WillChangeValueForKeyIndex + 6811 CoreData 0x2fdf636b _sharedIMPL_setvfk_core + 11012 CoreData 0x2fe1995d _PF_Handler_Public_SetProperty + 9213 CoreData 0x2fe1e2a9 -[NSManagedobject setValue:forKey:] + 12414 Application 0x0004dc45 -[DateFormatter storeValue:error:] (DateFormatter.m:65)15 Application 0x0004ee17 -[Formatter storeValue:inObject:] (Formatter.m:176)16 Application 0x0002b5c5 -[NSManagedobject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedobject+App.m:320)17 Application 0x0002b8f3 -[NSManagedobject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedobject+App.m:377)18 Application 0x0006352d -[ODataGetoperation processResult:] (ODataGetoperation.m:220)19 Application 0x0004420b -[ODataOperation connectionDIDFinishLoading:] (ODataOperation.m:741)20 Foundation 0x309bb47f __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 5421 Foundation 0x309bb3c1 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 20422 Foundation 0x309bb2dd -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 6023 CFNetwork 0x2fceaf8f ___ZN27URLConnectionClIEnt_Classic26_delegate_dIDFinishLoadingEU13block_pointerFvvE_block_invoke + 7424 CFNetwork 0x2fce9b8f ___ZN27URLConnectionClIEnt_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClIEntCurrent_VMaxE_block_invoke_2 + 5425 CFNetwork 0x2fd1b337 ___ZNK17CoreSchedulingSet13_performAsyncEPKcU13block_pointerFvvE_block_invoke + 1826 CoreFoundation 0x2ffb3ea1 CFArrayApplyFunction + 3627 CFNetwork 0x2fc81e05 RunloopBlockContext::perform() + 16428 CFNetwork 0x2fc81cd5 MultiplexerSource::perform() + 22029 CFNetwork 0x2fc81b65 MultiplexerSource::_perform(voID*) + 4830 CoreFoundation 0x3004bf1f __CFRUNLOOP_IS_CALliNG_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 1431 CoreFoundation 0x3004b3e7 __CFRunLoopDoSources0 + 20632 CoreFoundation 0x30049bd7 __CFRunLoopRun + 63033 CoreFoundation 0x2ffb4471 CFRunLoopRunspecific + 52434 CoreFoundation 0x2ffb4253 CFRunLoopRunInMode + 10635 Foundation 0x309a2697 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 25436 Application 0x00043b4b -[ODataOperation send] (ODataOperation.m:548)37 Application 0x0004277f -[ODataOperation operationWillStartPreparingData] (ODataOperation.m:131)38 Foundation 0x30a5396d __NSOQSchedule_f + 6039 libdispatch.dylib 0x3a8c64b7 _dispatch_async_redirect_invoke + 11040 libdispatch.dylib 0x3a8c77d9 _dispatch_root_queue_drain + 22441 libdispatch.dylib 0x3a8c79c5 _dispatch_worker_thread2 + 5642 libsystem_pthread.dylib 0x3a9f1dff _pthread_wqthread + 29843 libsystem_pthread.dylib 0x3a9f1cc4 start_wqthread + 8
最后一个方法在NSManagedobject子类中调用setValue:forKey :.
- (BOol)storeValue:(voID *)theValue error:(NSError **)theError{ Nsstring * value = (__brIDge Nsstring *)theValue; Nsstring * errorMessage = nil; if (![value length] && !isOptional) errorMessage = [Nsstring stringWithFormat: NSLocalizedString(@"Value cannot be nil or empty (Date) for fIEld %@",@""),varname]; else { NSDate * date = nil; if ([value length]) { date = [NSDate dateWithISO8601: value]; if (!date) errorMessage = [Nsstring stringWithFormat: NSLocalizedString(@"InvalID date %@ for fIEld %@",theValue,varname]; } if (Ivaraddress) *((__strong NSDate **) Ivaraddress) = date; else [currentObject setValue: date forKey: varname]; } if (errorMessage) { if (theError) *theError = [NSError errorWithDomain: AppDomain code: NSFormattingError userInfo: @{ NSLocalizedDescriptionKey: errorMessage }];#ifdef DEBUG NSLog(@"Formatter error: %@",errorMessage);#endif return NO; } return YES;} 我对任何建议完全开放:)
更新:密钥存在,并且设置的值是NSDate,因此它是NSManagedobject的属性,而不是关系.
更新2:
我还有另一个崩溃的方法(堆栈跟踪不完全相同):
Thread : Fatal Exception: NSInternalinconsistencyException0 CoreFoundation 0x30080e83 __exceptionPreprocess + 1301 libobjc.A.dylib 0x3a3dd6c7 objc_exception_throw + 382 CoreData 0x2fddfacb -[NSsqlCore _obtainopenChannel] + 2343 CoreData 0x2fea8ded newFetchedRowsForFetchPlan_MT + 8604 CoreData 0x2fde8949 -[NSsqlCore fetchRowForObjectID:] + 11805 CoreData 0x2fde8311 -[NSsqlCore newValuesForObjectWithID:withContext:error:] + 2566 CoreData 0x2fde762b _PFFaultHandlerLookupRow + 3987 CoreData 0x2fde7193 _PF_FulfillDeferredFault + 2188 CoreData 0x2fdf6449 _PF_Managedobject_WillChangeValueForKeyIndex + 689 CoreData 0x2fdf636b _sharedIMPL_setvfk_core + 11010 CoreData 0x2fe1995d _PF_Handler_Public_SetProperty + 9211 CoreData 0x2fe1e2a9 -[NSManagedobject setValue:forKey:] + 12412 Application 0x000fcc45 -[DateFormatter storeValue:error:] (DateFormatter.m:65)13 Application 0x000fde17 -[Formatter storeValue:inObject:] (Formatter.m:176)14 Application 0x000da5c5 -[NSManagedobject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedobject+.m:320)15 Application 0x000da8f3 -[NSManagedobject(App) setValuesForKeysWithReceivedDictionary:] (NSManagedobject+.m:377)16 Application 0x0011252d -[ODataGetoperation processResult:] (ODataGetoperation.m:220)17 Application 0x000f320b -[ODataOperation connectionDIDFinishLoading:] (ODataOperation.m:741)18 Foundation 0x309bb47f __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 5419 Foundation 0x309bb3c1 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 20420 Foundation 0x309bb2dd -[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 60
异常消息也不同:
_obtainopenChannel – NSsqlCore 0x15ef3780:没有可用的数据库通道
但我认为它们是两个相关的问题.
解决方法 所以我终于找到了与多线程/并发问题相关的原因.基本上同时更新两个线程上的相同对象..最近添加的核心数据调试标志(-com.apple.CoreData.ConcurrencyDeBUG 1)用于确定发生了什么.
总结以上是内存溢出为你收集整理的ios – 在setValue上崩溃:forKey:全部内容,希望文章能够帮你解决ios – 在setValue上崩溃:forKey:所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)