Reputation: 77
there's a problem when I try to send a large recipients list (e.g 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.
Upvotes: 4
Views: 3722
Reputation: 974
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.
Upvotes: 1
Reputation: 21
I think I maybe resolve this:
//must initiate new NSString object
NSString *phoneStr = [NSString stringWithFormat:@"%@",... ]; MFMessageComposeViewController *aCtrl = [[MFMessageComposeViewController alloc] init]; aCtrl.recipients = @[phoneStr]; ... Then OK.
Upvotes: 1
Reputation: 41
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.
Upvotes: 4
Reputation: 4953
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.
Upvotes: 2