Hey,
I am presenting an ABPeoplePickerNavigationController to the user and asking them to select a contact. Once they select a user, I want to have them sent to either the Messages app or the Email app depending on what property they selected. However, I can't figure out how to customize the action that occurs after the modal picker is dismissed.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
if(property == kABPersonPhoneProperty){
[self dismissModalViewControllerAnimated:YES];
NSString* phoneNumber = (NSString *)ABRecordCopyValue(person, property);
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"sms:%@", phoneNumber]];
[[UIApplication sharedApplication] openURL:url];
[phoneNumber release];
return NO;
}
if(property == kABPersonEmailProperty){
[self dismissModalViewControllerAnimated:YES];
NSString* emailAddress = (NSString *)ABRecordCopyValue(person, property);
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@", emailAddress]];
[[UIApplication sharedApplication] openURL:url];
[emailAddress release];
return NO;
}
return YES;
}
So, how do I do this? Thanks!