I am using the following code within my application to create and populate a SMS for the user to send. This code is called by pressing a UIButton.
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if([MFMessageComposeViewController canSendText])
{
controller.body = @"Hello from Mugunth";
controller.recipients = [NSArray arrayWithObjects:@"12345678", @"87654321", nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
On the initial loading of the view, I would like to test the device capabilities, and hide the button if necessary (for example on an iPod touch).
Are there any code examples on how to do this? Please note, I am only targeting iOS 4.0 and greater, I am aware the above code will not work on devices using earlier versions of iOS.