Currently,I am developing an app to track iPhone, so when the app is starting, the current location is automatically sent to the Recipient as a text message.
I have used the below code for sending message, but it is for MFMessageComposeViewController
. I have no idea about how to send message without presenting MFMessageComposeViewController
. So need some guidance on how this can be achieved. Here is the code :
NSArray *recipents = @[@"8866210464", @"9276820096"];
NSString *message = locationString; //String for current Location
MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
messageController.messageComposeDelegate=self;
[messageController setRecipients:recipents];
[messageController setBody:message];
[self presentViewController:messageController animated:NO completion:nil];
Thanks.