MFMessageComposeViewController在iOS7中显示空白屏幕

时间:2013-09-23 03:20:55

标签: iphone xcode sms ios7

当我尝试使用MFMessageComposeViewController发送大型收件人列表(例如超过40个)时出现问题。在iOS7中,在显示SMS撰写视图之前,它将显示20秒或更长时间的空白屏幕。 iOS5和iOS6不会出现这种情况。

以下是我正在使用的现有代码,

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];
}

以下是我尝试发送给许多人时收到的输出消息。

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.

5 个答案:

答案 0 :(得分:4)

我遇到了类似的问题,我在控制台中收到了消息“

  

等待来自com.apple.mobilesms.compose

的围栏障碍超时

问题是我在我的应用中尝试将数字添加为字符串,但由于本地化请求,我将其放在一个表单中:NSArray *recipents = @[NSLocalizedString(@"numberForRegistrationViaSms", @"")];

[messageController setRecipients:@[recipents]];

由于某些原因这不起作用,但是,当我简单地说[messageController setRecipients:@[@"123456789"]];时,SMS编辑器出现没有任何问题。

答案 1 :(得分:2)

我有同样的问题,然后想出

controller.recipients = //应该始终是一个字符串数组。

确保您发送给controller.recipients的电话号码是NSString。

答案 2 :(得分:1)

我想我可能会解决这个问题:

//必须启动新的NSString对象

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

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

Then OK.

答案 3 :(得分:1)

我有同样的问题。

  
      
  • 等待来自com.apple.mobilesms.compose的栅栏障碍超时

  •   
  • 消息已取消

  •   

而不是:

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

试试这个:

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

这对我有用。

答案 4 :(得分:-2)

iOS 7.0.3中已解决此问题。