MFMessageComposeViewController doesn't do anything in my iPhone 4.x, why?
I just upgraded to xcode 4.0.2, my iPhone is 4.3.5 and the MFMessageComposeViewController
doesn't do anything. It doesn't say "Can't send an SMS", it doesn't crash or abort, but it doesn't open the dialog to send the message either. It simply does nothing.
-(void)sendSMS:(NSString *)message recipientList:(NSArray *)recipients
{
if ([MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *controller =
[[[MFMessageComposeViewController alloc] init] autorelease];
if (controller != nil) {
controller.messageComposeDelegate = self;
开发者_StackOverflow controller.body = message;
controller.recipients = recipients;
[self presentModalViewController:controller animated:YES];
// [controller release]; // If I really did this it would crash.
}
}
}
OK I finally answered my own question. Now I want no one else to have to go through this.
I was calling this method from just an NSObject
. It was a delegate to MFMessageComposeViewControllerDelegate
but that made no difference. I had to move this method to my MainViewController
, then it worked.
精彩评论