我开发了一款应用,允许用户发送他们在应用中添加的联系人。我遇到的问题似乎是,如果用户已经存在于该人的本机iOS通讯录中,则该文本将不会发送任何问题。但如果联系人仅存在于应用程序中,则文本将不会通过。有没有其他人经历过这样的事情?
编辑:以下代码
if([MFMessageComposeViewController canSendText])
{
controller.body = @"";
controller.recipients = arrayContactMobileStrings;
controller.messageComposeDelegate = self;
[self presentViewController:controller animated:YES completion:nil];
}
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Message not sent", @"") message:NSLocalizedString(@"Error sending message", @"")
delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles: nil];
switch (result)
{
case MessageComposeResultCancelled:
[alert show];
break;
case MessageComposeResultFailed:
[alert show];
break;
case MessageComposeResultSent:
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion:nil];
}