Hi
Have anyone tried to use the SDK4's SMS composer? If anyone's got some reference or source code please put in here
Thanks
Hi
Have anyone tried to use the SDK4's SMS composer? If anyone's got some reference or source code please put in here
Thanks
If you've got the 4.0 SDK already, check MFMessageComposeViewController. The usage is similar to MFMailComposeViewController.
If you want to support 3.1 devices, you need to do a few things:
In your target's build settings:
In your target's general settings, under Linked Libraries, change the "Type" next to MessageUI.framework to Weak
.
Don't import <MessageUI/MFMessageComposeViewController.h>
or it will crash on launch on 3.1. Just import <MessageUI/MessageUI.h>
To make sure it doesn't crash on 3.1.x, you need to test for the availability of MFMessageComposeViewController:
Class smsClass = (NSClassFromString(@"MFMessageComposeViewController"));
if (smsClass != nil && [MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
controller.body = text;
controller.recipients = [NSArray arrayWithObjects: nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
[controller release];
}