1. Call built-in mail
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "mailto: // admin@hzlzh.com"];
2. Call phone
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "tel: // 8008808888"];
The iOS app returns to the app after the call ends.
Generally, you can call the following method in an application:
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "tel: // 123456789"];
When you call a phone in this way, the iphone interface will stay on the phone interface after the user finishes the call.
The following method can be used to automatically return to the application after the user finishes the call:
UIWebView * callWebview = [[UIWebView alloc] init];
NSURL * telURL = [NSURL URLWithString: @ "tel: 10086"]; // It Looks Like tel: // or tel:
[CallWebview loadRequest: [NSURLRequest requestWithURL: telURL];
// Remember to add to view
[Self. view addSubview: callWebview];
There is also a private method: (may not pass the Review)
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "telprompt: // 10086"];
3. Call SMS
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "sms: // 800888"];
4. Call the self-contained browser safari
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @ "http://www.hzlzh.com"];
You can call phone to pass the number. You can call SMS to set only the number and Cannot initialize the SMS content.
To transfer the content, you can do the following:
Add: MessageUI. framework
# Import <MessageUI/MFMessageComposeViewController. h>
Implement Proxy: MFMessageComposeViewControllerDelegate
Call the sendSMS Function
// Content, Recipient List
-(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];
}
}
// Process the sent response results
-(Void) messageComposeViewController :( MFMessageComposeViewController *) controller didFinishWithResult :( MessageComposeResult) result
{
[Self dismissModalViewControllerAnimated: YES];
If (result = MessageComposeResultCancelled)
NSLog (@ "Message canceled ")
Else if (result = MessageComposeResultSent)
NSLog (@ "Message sent ")
Else
NSLog (@ "Message failed ")
}
The default text message sending interface is in English. solution:
Add a chinese group to Localization in. xib.