Matan Elimelech
Matan Elimelech

Reputation: 23

sending sms programmatically in ios 7

Im trying to send an sms programmatically and in ios 6 its works perfect but in ios 7 its not working. Its open a white view with nothing inside and just stuck my app!

my code looks like this:

MFMessageComposeViewController *messageVC = [[MFMessageComposeViewController alloc] init];
[messageVC setMessageComposeDelegate:self];
if ([MFMessageComposeViewController canSendText]) {

    NSString *smsString = [NSString stringWithFormat:@"bla bla bla"];
    messageVC.body = smsString;
    messageVC.recipients = @[userPhone];
    messageVC.messageComposeDelegate = self;
[self presentViewController:messageVC animated:YES completion:nil];
}

please help!! ios7 driving me crazy!

Upvotes: 1

Views: 1997

Answers (1)

Mr. Cobblepot
Mr. Cobblepot

Reputation: 141

Your code works fine, but the message "Text messaging is not available" is given on devices that are not capable to send messages. I tested on an iPad Mini and it's working fine.

Upvotes: 1

Related Questions