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;
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 toMFMessageComposeViewControllerDelegatebut that made no difference. I had to move this method to myMainViewController, then it worked.