Question

I need to send email programmatically in iphone os 2.0.

some where i found

NSString *url = [NSString stringWithString: @"mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];

is this is code work on iphone os 2.0.

similarly I need to send sms in iphone 2.0 and make a call.

I found it is not possible in sending sms in iphone 2.0 and making call.

Is there any third party tools to send sms?

Was it helpful?

Solution

You cannot send an SMS programmatically under any version of iOS, ever.

Under iOS 2 and 3 you can present the SMS app with a sms:// link and you can include the number to send it to, but that's it. You cannot include the message body, and no matter what you can never send the message. The user must send the message.

Under iOS 4 you can present a view controller with the number to send it to and the message body using MFMessageComposeViewController, but you still cannot send the message. The user can tap the send button, but that's it.

Apple specifically protects iPhone owners from SMS messages being sent without their knowledge and approval.

OTHER TIPS

To make a call from your app call this line:

[[UIApplication application] openURL:[NSURL URLWithString:@"tel://THE_TELEPHONE_NUMBER"]];

Remember this won't work in the Simulator and you may want to check if the device is an iPod or iPad before calling! I also tend to show a UIAlertView asking the user if they actually want to call the number as this can be very annoying if they didn't mean it.

For SMS: Check out this How to programmatically send SMS on the iPhone?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top