Search code examples
iphoneobjective-cxcodepresentmodalviewcontrollermfmessagecomposeviewcontroller

MFMessageComposeViewControllerDelegate error - black screen


I'm using the following code to show in-app sms. My app don't have a status bar. (I'm using 320x480 pixels screen in portrait view).

the problem is that when I load the controller, the screen becomes black as you can see from the image...

http://desmond.imageshack.us/Himg211/scaled.php?server=211&filename=schermata092456187alle1.png&res=landing

this is the code:

            MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
            picker.messageComposeDelegate = self;

            picker.recipients = [NSArray arrayWithObject:@"123456789"];   // your recipient number or self for testing
            picker.body = @"test";

            [self presentModalViewController:picker animated:YES];

Solution

  • Testing the MFMessageComposeViewController is currently not supported in the simulator. The MFMailComposeViewController is though.

    Try out your code on an actual device and it will work.