Hi,
I have implemented an addressbook, I don't know what I do wrong, but whenever I select an address my whole app crashes and i receive the error
> 2010-10-21 11:57:13.922 ANWB[2989:207]
> *** Terminating app due to uncaught exception 'NSRangeException', reason:
> '*** -[NSCFArray objectAtIndex:]:
> index (0) beyond bounds (0)'
> 2010-10-21 11:57:13.935 ANWB[2989:207]
> Stack: (
> 843263261,
> 825818644,
> 842812211,
> 842812115,
> 862975761,
> 863130919,
> 110753,
> 870859136,
> 870898732,
> 870982260,
> 870977388,
> 844473760,
> 844851728,
> 862896011,
> 843011267,
> 843009055,
> 860901832,
> 843738160,
> 843731504,
> 9921,
> 9836 )
My code looks like this:
ABPeoplePickerNavigationController *picker =
[[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[picker setDisplayedProperties:[NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonAddressProperty]]];
[self presentModalViewController:picker animated:YES];
[picker release];
- (void)peoplePickerNavigationControllerDidCancel:
(ABPeoplePickerNavigationController *)peoplePicker {
[self dismissModalViewControllerAnimated:YES];
}
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person {
return YES;
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier {
// Only inspect the value if it's an address.
if (property == kABPersonAddressProperty) {
ABMutableMultiValueRef multiValue = ABRecordCopyValue(person, property);
for(CFIndex i=0;i<ABMultiValueGetCount(multiValue);i++)
{
CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(multiValue, i)
;
.....
I don't know why it's telling me that an array created this error
please help me
Edit: Guys, Thanks for the answers, but apparently the problem wasn't even in this code it was a problem from somewhere else really appreciate the help though