简体   繁体   English

MFMessageComposeViewController在iOS7中显示空白屏幕

[英]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. 当我尝试使用MFMessageComposeViewController发送大型收件人列表(例如超过40个)时出现问题。 In iOS7, it will show a blank white screen for 20s or more before displaying the SMS compose view. 在iOS7中,在显示SMS撰写视图之前,它将显示20秒或更长时间的空白屏幕。 This does not occur for iOS5 and iOS6. iOS5和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 从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", @"")]; 问题是我在我的应用程序中尝试将数字添加为字符串,但由于本地化请求,我将其放在一个表单中: NSArray *recipents = @[NSLocalizedString(@"numberForRegistrationViaSms", @"")];

and

[messageController setRecipients:@[recipents]];

That didn't work for some reason but, when I put just simply, [messageController setRecipients:@[@"123456789"]]; 由于某些原因,这不起作用,但是,当我简单地说, [messageController setRecipients:@[@"123456789"]]; , the SMS composer appears without any problem. ,SMS编辑器出现没有任何问题。

I to had the same problem then figured 我想到了同样的问题

controller.recipients = // should always be an array of strings. controller.recipients = //应该始终是一个字符串数组。

Make sure the phone numbers you send to controller.recipients are NSString. 确保发送给controller.recipients的电话号码是NSString。

I think I maybe resolve this: 我想我可能会解决这个问题:

//must initiate new NSString object //必须启动新的NSString对象

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 从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中得到解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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