Search code examples
smsios5

Is there a way of telling if a device can send text messages or just iMessage?


I have an app that is configured to send in-app sms messages to a defined number. In viewDidLoad I check to see if the device can send text messages using [MFMessageComposeViewController canSendText] and then hide the control if it's not supported by the device.

This has worked fine up until now, but now I'm updating it for iOS 5 and have found devices that don't support SMS, but do support iMessage receive a YES message from [MFMessageComposeViewController canSendText].

As the receiving number is not an iOS 5 device, any messages sent on the iMessage service fail. Just to make things worse, the delegate method messageComposeViewController:didFinishWithResult: reports MessageComposeResultSent, so I can't even display a message after the event. The only time a user gets to see that the message wasn't delivered is if they look in the messaging app, the messages are then marked as 'Not Delivered'.

So, is there a way of querying the device to find out if it can send 'real' sms messages or if it's just got iMessage support?


Solution

  • You can try to determine, if your current device can make calls by: [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString: @"tel://"]]

    And if this returns YES, you know your device has GSM/CDMA module, that means you can send SMS. If you get NO, you can send iMessage only.