내 상황은 다음과 : 우리는 (무엇보다도) Exchange의 공용 폴더에서 데이터를 표시하는 응용 프로그램을 만드는주소록 API 비애 - NSInternalInconsistencyException
. 우리는 iPhone App이 기본적으로 (Apple의 AddressBook 앱과 같이) iPhone과 같은 연락처를 표시하기를 바랍니다. 따라서 우리는 AddressBook API를 사용하고 있습니다. 그러나 iPhone 자체에 표시된 연락처는 저장하지 않으므로 Exchange의 공용 폴더에 연락처를 표시하는 데 사용됩니다.
연락처 레코드를 표시하려고 할 때 'pushViewController'메서드를 사용하여 'ABUnknownPersonViewController'를 표시합니다. 코드에서 우리는 ABPersonCreate() 메서드를 사용하여 ABRecordRef 객체를 생성합니다. 그것의 부분은 잘 동작하고, 헤더에있는 이름과 기타 세부 사항을 볼 수 있습니다 (그림 위치 지정자 옆). 그러나 UITableViewCell 레이아웃 (예 : 전화, 주소 등)에 표시 할 세부 정보를 추가하면 표시되지 않습니다. 나쁘게 여전히 두 번째 시간 동안 ABPersonViewController를로드하고 'setDisplayedPerson :'메서드가 호출되면 앱이 다운됩니다. 참고 : 처음에는 제대로로드되지만 UITableViewCell에 표시되어야하는 데이터는 표시되지 않습니다.
2010-08-10 16:23:21.624 SharepointApp[5058:207] *** Assertion failure in -[ABPersonTableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1261.5/UITableView.m:904
2010-08-10 16:23:21.627 SharepointApp[5058:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Invalid update: invalid number of sections. The number of sections contained in the table view after the update (1) must be equal to the
number of sections contained in the table view before the update (0), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).'
*** Call stack at first throw:
(
0 CoreFoundation 0x02b05919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02c535de objc_exception_throw + 47
2 CoreFoundation 0x02abe078 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0019a8cf -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x0041863e -[UITableView(_UITableViewPrivate) _endCellAnimationsWithContext:] + 7808
5 UIKit 0x004086d1 -[UITableView endUpdates] + 42
6 AddressBookUI 0x025a2016 -[ABPersonTableViewDataSource setCurrentTableHeaderView:] + 49
7 AddressBookUI 0x025a194d -[ABPersonTableViewDataSource updateTableHeaderView] + 928
8 AddressBookUI 0x025a2276 -[ABPersonTableViewDataSource setPersonModelController:] + 441
9 AddressBookUI 0x025ef9f0 -[ABPersonViewControllerHelper setDisplayedPeople:] + 307
10 AddressBookUI 0x025efbe5 -[ABPersonViewControllerHelper _updateDisplayedPeople] + 198
11 SharepointApp 0x0006866f -[WSPublicContactDetailViewController retrievePersonDataCompleted:] + 654
12 Foundation 0x0011ee9a __NSThreadPerformPerform + 251
13 CoreFoundation 0x02ae6d7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
14 CoreFoundation 0x02a452cb __CFRunLoopDoSources0 + 571
15 CoreFoundation 0x02a447c6 __CFRunLoopRun + 470
16 CoreFoundation 0x02a44280 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x02a441a1 CFRunLoopRunInMode + 97
18 GraphicsServices 0x0307b2c8 GSEventRunModal + 217
19 GraphicsServices 0x0307b38d GSEventRun + 115
20 UIKit 0x003adb58 UIApplicationMain + 1160
21 SharepointApp 0x00002878 main + 102
22 SharepointApp 0x000027e6 start + 54
23 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
여기 내 코드의 일부 :
ABRecordRef person = ABPersonCreate();
if (person) {
ABRecordSetValue(person, kABPersonLastNameProperty, @"Schreurs", NULL);
ABRecordSetValue(person, kABPersonFirstNameProperty, @"Wolfgang", NULL);
ABRecordSetValue(person, kABPersonOrganizationProperty, @"Webstate", NULL);
ABMultiValueRef phone = ABMultiValueCreateMutable(kABStringPropertyType);
if (phone) {
ABMultiValueAddValueAndLabel(phone, @"06 123 432 23", kABPersonPhoneMobileLabel, NULL);
ABRecordSetValue(person, kABPersonPhoneProperty, phone, NULL);
CFRelease(phone);
}
[self setUnknownPersonViewDelegate:self];
[self setDisplayedPerson:person];
CFRelease(person);
}