I'm trying to use MFMessage to send a text message from my app and I can send the message to around 15 people, but more than that, it successfully que's but the Messages app on the device says the text is not deliverable. There's not much information given to why it fails, it just does. Is there something different I should be doing, or a reason this would be happening?
Here's how I'm sending the message currently:
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.01 * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
if(thread.smsMembers.count>0)
{
if(![MFMessageComposeViewController canSendText]) {
UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device doesn't support SMS!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[warningAlert show];
return;
}
NSString *message = text;
self.messageController = [[MFMessageComposeViewController alloc] init];
[_messageController setMessageComposeDelegate:self];
[_messageController setRecipients:thread.smsMembers];
if(!type){
[_messageController setBody:message];
} else{
if([type isEqual: @"image"]){
NSData *imageData = [file getData];
[_messageController addAttachmentData:imageData typeIdentifier:(NSString *)kUTTypePNG filename:@"image.png"];
} else if([type isEqual: @"video"]){
NSData *videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:file.url]];
[_messageController addAttachmentData:videoData typeIdentifier:(NSString *)kUTTypeMovie filename:@"video.mov"];
}
}
[self presentViewController:_messageController animated:YES completion:nil];
}
});