Je présente un ABPeoplePickerNavigationController à l'utilisateur et lui demande de sélectionner un contact. Une fois qu'ils ont sélectionné un utilisateur, je souhaite qu'ils soient envoyés à l'application Messages ou à l'application E-mail en fonction de la propriété qu'ils ont sélectionnée. Cependant, je ne peux pas comprendre comment personnaliser l'action qui se produit après le sélecteur modal est rejeté.Action personnalisée après le rejet de ABPeoplePickerNavigationController
- (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;
}
Alors, comment faire? Merci!
Je suis conscient que mon application va perdre le contrôle. J'essaie d'intercepter la sélection de propriétés afin de personnaliser le courrier électronique qui s'ouvre. Je peux définir le sujet/corps pour l'utilisateur par commodité.En outre, s'ils sélectionnent un numéro de téléphone, je souhaite que l'application SMS apparaisse, et non l'application Téléphone. Ainsi, j'ai besoin de l'intercepter puis d'appeler l'openURL approprié. – Georges