I have a UITableViewController presenting a list of contacts, when the user selects a row, it'll show a UIActionSheet to ask the user an action (call, send sms...).
The user selects an action, and that first UIActionSheet will show another UIActionSheet which contains phone numbers.
The user selects a phone number, and this should show the SMS message composer.
The problem is that when the user selects a phone number, the message composer view doesn't show (just a black screen), and I receive the MessageComposeResultCancelled in the MFMessageComposeViewController's didFinishWithResult.
Which generates this warning "Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!"
How can I correctly call and show the SMS message composer?
(this works perfectly if I call it directly when the user selects a row in the list with didSelectRowAtIndexPath)
Here's some code :
1- call to first UIActionSheet in didSelectRowAtIndexPath method :
UIActionSheet *popupQuery;
...
[popupQuery showInView:self.view];
2- call to second UIActionSheet in clickedButtonAtIndex method :
UIActionSheet *popupQuery2;
...
[popupQuery showInView:self.view];
3- from the same method, call to message composer :
[self sendSMS:@"" recipientList:[phoneNumbers objectAtIndex:buttonIndex]];
the method that shows message composer :
(void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients
{
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
controller.body = bodyOfMessage;
controller.recipients = recipients;
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
}