CoreData를 사용하는 응용 프로그램을 개발 중입니다. 뷰에는 NSFetchedResultsController를 사용하는 UITableView (약 50 개 요소 포함)가 있습니다. 또한 WS 콜 (새 관리 대상 객체 컨텍스트가있는 다른 스레드에서) 후에 저장된 데이터를 새로 고치는 것을 허용하는 "새로 고침 (Pull to refresh)"기능이 있습니다.iOS4에서 NSFetchedResultsController 문제가 발생했습니다.
모든 것이 iOS5에서 정상적으로 작동합니다. "새로 고침하기"를 수행하면 데이터베이스와 tableview가 새로 고쳐집니다. 그러나 iOS4에는 문제가 있습니다. 응용 프로그램이 시작됩니다합니다 (있는 tableview 모든 데이터베이스 레코드를 포함)하지만 다음과 같은 오류가있어 때 나는 "이 당겨서 새로 고침 '을 수행 할 때 첫 번째"performFetch는 "작동합니다
2012-02-29 11:56:09.119 Nanopost[1996:207] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x5c3c760 <x-coredata://E176B0A1-275B-4332-9231-49FD88238C2B/Ads/p231>''
*** Call stack at first throw:
(
0 CoreFoundation 0x02bfe919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02e595de objc_exception_throw + 47
2 CoreData 0x028b833f _PFFaultHandlerLookupRow + 1407
3 CoreData 0x028b5ee3 _PF_FulfillDeferredFault + 499
4 CoreData 0x028b9f3f _sharedIMPL_pvfk_core + 95
5 CoreData 0x0292a010 _PF_Handler_Public_GetProperty + 160
6 Foundation 0x02442c4f -[NSSortDescriptor compareObject:toObject:] + 128
7 CoreData 0x0297db5e +[NSFetchedResultsController(PrivateMethods) _insertIndexForObject:inArray:lowIdx:highIdx:sortDescriptors:] + 286
8 CoreData 0x0297e1b2 -[NSFetchedResultsController(PrivateMethods) _postprocessInsertedObjects:] + 402
9 CoreData 0x029841bc -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 1804
10 Foundation 0x02380c1d _nsnote_callback + 145
11 CoreFoundation 0x02bd6cf9 __CFXNotificationPost_old + 745
12 CoreFoundation 0x02b5611a _CFXNotificationPostNotification + 186
13 Foundation 0x023767c2 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134
14 CoreData 0x028c0519 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 89
15 CoreData 0x028f802b -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:] + 1579
16 Foundation 0x02395e9a __NSThreadPerformPerform + 251
17 CoreFoundation 0x02bdfd7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
18 CoreFoundation 0x02b3e2cb __CFRunLoopDoSources0 + 571
19 CoreFoundation 0x02b3d7c6 __CFRunLoopRun + 470
20 CoreFoundation 0x02b3d280 CFRunLoopRunSpecific + 208
21 CoreFoundation 0x02b3d1a1 CFRunLoopRunInMode + 97
22 GraphicsServices 0x031e62c8 GSEventRunModal + 217
23 GraphicsServices 0x031e638d GSEventRun + 115
24 UIKit 0x0063cb58 UIApplicationMain + 1160
25 Nanopost 0x0000230a main + 170
26 Nanopost 0x00002255 start + 53
)
terminate called after throwing an instance of '_NSCoreDataException'
나는"NSFetchRequest를 초기화하면 FetchBatchSize "나는 설정"iOS4 나는 돈에
[l_FetchRequest setFetchBatchSize:25];
... 더 이상 충돌 : 25 FetchBatchSize ""(무작위) 20
[l_FetchRequest setFetchBatchSize:20];
을하지만 난을 설정하면 " ~ 왜이 문제를 이해해야하는지 알고 싶습니다. 나는이 선이 실제 문제라고 생각하지 않습니다. 어딘가 다른 문제를 나타낼 수 있습니까?
답장을 보내 주셔서 감사합니다.
토마스
안녕 데미안
데미안 및 답변에 대한 감사합니다! Apple의 설명서 (다른 스레드 = 다른 관리 대상 객체 컨텍스트)에 따르면 "모범 사례"로 보일 수 있으므로 다른 컨텍스트를 사용합니다. "예외 중단 점"을 추가하려고했습니다. 불행하게도이 예외에 대한 단서를 얻지 못하기 때문에 main.m 파일에 예외가 발생합니다. 토마스 –
main.m의 예외는 처리되지 않았고 전체 스택을 풀어 버린다는 것을 의미합니다. 예외 중단 점은 던져지는 즉시 발생합니다. 작동 할 때까지 다시 시도하십시오. 프로그램이 중단 될 때 프로그램의 위치를 정확히 파악하는 것이 중요합니다. –