crashing on iPhone Address API
Posted
by phil swenson
on Stack Overflow
See other posts from Stack Overflow
or by phil swenson
Published on 2010-04-02T03:39:03Z
Indexed on
2010/04/02
3:43 UTC
Read the original article
Hit count: 206
iphone-sdk
Any ideas on why this code would crash (crash location indicated below)?
email is a valid NSString*... ([email protected])
+(void)newContactFromEmail:(DetailViewController*)controller email:(NSString*)emailAddress{
ABNewPersonViewController *npvc = [[ABNewPersonViewController alloc] init];
ABRecordRef newPerson = ABPersonCreate();
[self updateEmail:newPerson email:emailAddress];
npvc.displayedPerson = newPerson;
npvc.newPersonViewDelegate = controller;
[controller.navigationController pushViewController:npvc animated:YES];
}
+(void)updateEmail:(ABRecordRef)person email:(NSString*)email{
**crashes Here**---->> ABMutableMultiValueRef multiEmail = ABMultiValueCreateMutableCopy (ABRecordCopyValue(person, kABPersonEmailProperty));
ABMultiValueAddValueAndLabel(multiEmail, email, kABHomeLabel, NULL);
ABRecordSetValue(person, kABPersonEmailProperty, multiEmail, nil);
CFRelease(multiEmail);
}
© Stack Overflow or respective owner