Setp-3 Suppose you want to send SMS on button touch(click) then write the following code in your implementation (SendSMS.m) file.
MFMessageComposeViewController *controller =[[MFMessageComposeViewController alloc] init]; controller.messageComposeDelegate = self; // CHECK DEVICE CAN SEND TEXT MESSAGE. if([MFMessageComposeViewController canSendText]){ // message subject. controller.subject=@“this is message subject. ”; // message body controller.body=[NSString stringWithFormat:@“ This is the testing message. “]; // contact number you want to send . controller.recipients = [NSArray arrayWithObjects:@” 123456”,nil];
// check the condition in case of model view controller is not dismissed. if (![[self presentedViewController] isBeingPresented]) { [self dismissViewControllerAnimated:YES completion:nil];
Allen Scott
19-Feb-2015Few steps will led u to understand the simple implementation involved in it:
Step.1-Include MessageUI.framework in your project.
Step-2 Import MessageUI/MessageUI.h in your header file like that in my case.