iOS call phone, SMS, etc.

Source: Internet
Author: User

1.Call Telephone PhoneReturn apps in iOS apps when you end your phone call is typically made in the app by dialing:

Nsurl *url = [Nsurl urlwithstring:[nsstring stringwithformat:@ "tel:10086"]];

[[UIApplication sharedapplication] openurl:url];

When you make a call this way, the iphone interface stays on the phone interface when the user ends the call.  The user will be automatically returned to the application after the call is completed in the following way: Uiwebview*callwebview =[[uiwebview alloc] init]; Nsurl *telurl =[nsurl urlwithstring:@ "tel:10086"];//looks like tel://or tel: all line [Callwebview loadrequest:[nsurlrequest RequestW  Ithurl:telurl]]; Remember to add to view [Self.view addsubview:callwebview];//cannot be missing2.    call to bring your own mail[[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];
   3. Call SMS[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "sms://800888"];4. Call your own browser Safari[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "http://www.hzlzh.com"]; Call phone can pass number, call SMS can only set number, cannot initialize SMS content.If you need to pass content, you can do the following:Join: Messageui.framework #import <MessageUI/MFMessageComposeViewController.h> Implement Proxy: MfmessagecomposeviewcontrollerdelegateCall 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];}} Processing the response sent out-(void) Messagecomposeviewcontroller: (Mfmessagecomposeviewcontroller *) Controller Didfinishwithresult :(Messagecomposeresult) result{[self dismissmodalviewcontrolleranimated:yes];if (Result = = messagecomposeresultcancelled) NSLog (@ "Message cancelled") else if (result = = Messagecomposeresultsent) NSLog (@ " Message sent ") Elsenslog (@" Message failed ")}
The default text messaging interface is in English, the solution is: Add a group of Chinese in. Xib Localization OK

iOS call phone, SMS, etc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.