简体   繁体   中英

MFMessageComposeViewController shows blank white screen in iOS7

there's a problem when I try to send a large recipients list (eg more than 40) using MFMessageComposeViewController. In iOS7, it will show a blank white screen for 20s or more before displaying the SMS compose view. This does not occur for iOS5 and iOS6.

Below is the existing code that I'm using,

NSArray * recipients;

for (NSIndexPath * index in selectedRows) 
{ 
   NSDictionary *dictionary = [data objectAtIndex:index.row];
   NSString *phoneNum =  [dictionary objectForKey:@"contactNum"];
   recipients = [NSArray arrayWithObjects:phoneNum, nil]];
}

MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];

if([MFMessageComposeViewController canSendText])
{
    controller.body = bodyOfMessage;
    controller.recipients = recipients;
    controller.messageComposeDelegate = self ;
    controller.wantsFullScreenLayout = NO;
    [(id)_delegate presentModalViewController:controller animated:YES];
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

Below are the output message that I received when I try to send to many.

timed out waiting for fence barrier from com.apple.mobilesms.compose
Received memory warning.
Received memory warning.
Received memory warning.
Received memory warning.
Received memory warning.
Received memory warning.
Received memory warning.
Received memory warning.
Received memory warning.

I had a similar problem where I got the message in the console "

timed out waiting for fence barrier from com.apple.mobilesms.compose

The problem was that I tried in my app to add the number as a string, but because of the localization request, I have put it in a form: NSArray *recipents = @[NSLocalizedString(@"numberForRegistrationViaSms", @"")];

and

[messageController setRecipients:@[recipents]];

That didn't work for some reason but, when I put just simply, [messageController setRecipients:@[@"123456789"]]; , the SMS composer appears without any problem.

I to had the same problem then figured

controller.recipients = // should always be an array of strings.

Make sure the phone numbers you send to controller.recipients are NSString.

I think I maybe resolve this:

NSString *phoneStr = [NSString stringWithFormat:@"%@",... ];                                                     

MFMessageComposeViewController *aCtrl = [[MFMessageComposeViewController alloc] init];
aCtrl.recipients                      = @[phoneStr];
...

Then OK.

I had same problem.

  • timed out waiting for fence barrier from com.apple.mobilesms.compose

  • Message Cancelled

Instead of this:

    NSString *phoneNumber = @"888888888";
    [picker setRecipients:@[phoneNumber]];

Try this:

    NSString *phoneNumber = person.phoneNumber;
    [picker setRecipients:@[[NSString stringWithFormat:@"%@", phoneNumber]]];

This worked for me.

该问题已在iOS 7.0.3中得到解决。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM