Here’s few steps on how to add iMessage support to your Xcode project:
Step 1: Add “MessageUI.framework” into your Xcode Project
Step 2: Call the function in your ViewController.m file like so: #import “MessageUI/MessageUI.h”
Step 3: This code goes into your ViewController.m file:
-(IBAction) sendInAppSMS:(id) sender
{
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if([MFMessageComposeViewController canSendText])
{
controller.body = @”Hello from Andriy Kharkovyy”;
controller.recipients = [NSArray arrayWithObjects:@"1232221111", nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
}
Step 4: Beneath that allow for the action to be terminated like so:
- (void) messageComposeViewController:(MFMessageComposeViewController *)
controller didFinishWithResult:(MessageComposeResult)result
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@”MyApp” message:@”Unknown Error”
delegate:self cancelButtonTitle:@”OK” otherButtonTitles: nil];
switch (result) {
case MessageComposeResultCancelled:
NSLog(@”Cancelled”);
break;
case MessageComposeResultFailed:
[alert show];
break;
case MessageComposeResultSent:
break;
default:
break;
}
[alert release];
[self dismissModalViewControllerAnimated:YES];
}
That’s about it.







thanks for the tip