iphone 4.0 sending sms programmatically
I am working on a simple application in which I need send sms programmatically to my friends. so write below code for sending sms .
MFMessageComposeViewController *picker = [[[MFMessageComposeViewController alloc] init]autorelease];
if([MFMessageComposeViewController canSendText])
{
picker.messageComp开发者_开发技巧oseDelegate = self;
picker.recipients =[NSArray arrayWithObject:@"123"];
picker.body=@"hello";
[self presentModalViewController:picker animated:YES];
}
but I do not want to load message picker and send sms to friends. // [self presentModalViewController:picker animated:YES];
is it possible to send sms without click in send button.The two options available in the iOS API are:
MFMessageComposeViewController
- requires user confirmationsms://
URLs - requires user confirmation
If you want to do something else, you'll need to set up a network-based service with an SMS gateway provider and send messages via that. I used to work with such a provider that had an HTTP POST interface, which would be simple enough to use. That comes with a couple of important differences:
- the SMS is actually sent by the gateway server, not the handset (though you can usually rewrite the sender ID and get the message billed to the handset owner)
- you'll need to pay for access to the service, which might include paying per message (or more likely per 1,000 messages)
Also note that sending SMS on your users' behalf without confirmation might be frowned upon when your app is reviewed, especially if they're billed for.
精彩评论