In my app, it is very important to know whether SMS has been sent or not. For checking, I am using this delegate method:
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{
switch (result) {
case MessageComposeResultCancelled: {
[NSThread detachNewThreadSelector:@selector(SMScancelled) toTarget:self withObject:nil];
}
break;
case MessageComposeResultSent: {
[NSThread detachNewThreadSelector:@selector(SMSsent) toTarget:self withObject:nil];
}
break;
case MessageComposeResultFailed: {
[NSThread detachNewThreadSelector:@selector(SMSfailed) toTarget:self withObject:nil];
}
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion:nil];
}
My problem is, that when testing, I turn on Airplane mode in settings (to test what will happen) and then I am trying to send SMS (using my app). Naturally, iOS fails to send it and system informs me about that. In message app, it is also shown, that I have failed to send it. But delegate method still returns MessageComposeResultSent instead of MessageComposeResultFailed. This situation also happens when I test on another phone that has no SIM card.
I am testing this on iOS 7 and iOS 8.
In documentation, there is written, that MessageComposeResultSent means "The user successfully queued or sent the message". This means, behaviour I am expecting is correct.
So how to know, whether my last SMS has been succesfully sent, or that sending has failed?