4

当我尝试使用 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.
4

5 回答 5

4

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

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

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

[messageController setRecipients:@[recipents]];

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

于 2014-03-16T18:38:12.760 回答
2

我有同样的问题然后想通了

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

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

于 2014-02-18T11:49:31.607 回答
1

我有同样的问题。

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

  • 消息已取消

而不是这个:

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

尝试这个:

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

这对我有用。

于 2015-03-26T08:24:42.567 回答
1

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

//必须初始化新的NSString对象

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

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

然后确定。

于 2014-07-30T00:58:27.180 回答
-2

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

于 2013-10-23T09:11:35.540 回答