I am trying to show an MFMessageComposeViewController with the following code:
controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
controller.body = [NSString stringWithFormat:@"%@%@%@", itemString, amountString, callTimeString];
controller.recipients = [NSArray arrayWithObject:@"12345678"];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
The problem is when I press the button to bring up the MFMessageComposeViewController, the alloc takes a few seconds. I have tried moving the alloc line to my viewDidLoad method, however this just moves the problem and I end up waiting a few seconds for the view to load.
Is there any method to speed up the alloc and showing of my MFMessageComposeViewController or use a delegate method or something?
Thanks.
Well, what you are doing seems about right. You are not doing anything wrong. Check this - Can't set recipients of MFMessageComposeViewController? & the link attached in the answer