I have been working on implementing SMS messaging into my app. Unfortunately whenever I test it I always get the default result, even if it does send the message and I receive it on the other end. What am I doing wrong, I have compared other examples and mine looks the same. Does this work with iMessage??? Now I am always getting it as sent, even if I go into text messaging and it will say failed.
// feedback message field with the result of the operation.
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller
didFinishWithResult:(MessageComposeResult)result {
switch (result)
{
case MFMailComposeResultCancelled:
[self displayStickieUniversalViewControllerTitleString:@"Cancelled" bodyString:@"You cancelled sending the SMS.The event will be saved in the calendar." buttonString:@"Ok, Save Event" bodyTextSize:12.0f buttonTextLines:3];
break;
case MFMailComposeResultSent:
[self displayStickieUniversalViewControllerTitleString:@"SMS sent" bodyString:@"Your SMS was sent. The event will be saved in the calendar." buttonString:@"Ok, Save Event" bodyTextSize:12.0f buttonTextLines:3];
break;
case MFMailComposeResultFailed:
[self displayStickieUniversalViewControllerTitleString:@"Failed" bodyString:@"Failed to send SMS. The event will be saved in the calendar." buttonString:@"Ok, Save Event" bodyTextSize:12.0f buttonTextLines:3];
break;
default:
[self displayStickieUniversalViewControllerTitleString:@"Failed" bodyString:@"Failed to send SMS. The event will be saved in the calendar." buttonString:@"Ok, Save Event" bodyTextSize:12.0f buttonTextLines:3];
break;
}
[self dismissModalViewControllerAnimated:YES];
}
/////
if (actionClicked == @"smsEvent") {
if ([attendeesArray count]!=0) {
NSLog(@"Yes clicked, will send sms confirmation");
Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
if (messageClass != nil) {
if ([messageClass canSendText]) {
[self displaySMSComposerSheet];
}
else {
[self displayStickieUniversalViewControllerTitleString:@"Device not configured to send SMS." bodyString:@"The event will be saved in the calendar." buttonString:@"Save Event" bodyTextSize:14.0f buttonTextLines:2];
}
}
else {
[self displayStickieUniversalViewControllerTitleString:@"Device not configured to send SMS." bodyString:@"The event will be saved in the calendar." buttonString:@"Save Event" bodyTextSize:14.0f buttonTextLines:2];
}
}
}
It looks like you are using the wrong enum maybe something to do with it mine looks like this: