Orun
Orun

Reputation: 4603

Is it possible to automatically send SMS's from an iPhone App other than the native text message app?

With the SDK / Cocoa Touch, is it feasible to make an app that will SMS automatically? My objective isn't to SPAM anyone.

Upvotes: 5

Views: 2628

Answers (3)

Esepakuto
Esepakuto

Reputation: 1332

Three is a way to pre-build an SMS using MFMessageComposeViewController. The only issue with this method is that a modal view will be shown to the user to accept the SMS (like the window that sends an e-mail by the default way). There is no way to send a SMS in "silent mode" without jailbreak.

{    
...
[self sendSMS:@"_SMS_TEXT_" recipientList:[NSArray arrayWithObjects:@"PHONE_NUMBER", nil]];
...
}

- (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients
{
    MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
    if([MFMessageComposeViewController canSendText])
    {
        controller.body = bodyOfMessage;    
        controller.recipients = recipients;
        controller.messageComposeDelegate = self;
        [self presentModalViewController:controller animated:YES];
    }    
}

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
    [self dismissModalViewControllerAnimated:YES];

    if (result == MessageComposeResultCancelled)
        NSLog(@"Message cancelled")
    else if (result == MessageComposeResultSent)
        NSLog(@"Message sent")  
    else 
        NSLog(@"Message failed")  
}

Upvotes: 2

Michael Frederick
Michael Frederick

Reputation: 16714

You would need a server that would handle the SMS for you, and an API for the app to interact with that server. It's not possible to have your app send messages directly from the phone, but you can certainly have your app interact with an external service that will send the messages for you.

Upvotes: 3

user529758
user529758

Reputation:

It is not possible, exactly for the reason you mentioned: it would make spamming possible.

Upvotes: 5

Related Questions