0

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.

2 Answers 2

2

No, not possible. This is to protect the user's privacy.

Sign up to request clarification or add additional context in comments.

Comments

0

You can't do it without MFMessageComposeViewController. Apple won't allow to send SMS without user interaction.

I've alternate solution of this, out of scope of iOS:

Use web service API. Create a web service at server side that send a message to specific number(s) that accept numbers as parameters with request.

At specific time interval (according to your requirement) send a web service call with number as request parameter.

Web server can do it. It can send message to any device.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.