system function calls

Source: Internet
Author: User

First, call the system phone

// Call system Call function -(void) callphonenumber{    *allstring = [NSString stringWithFormat:@ "  tel:10086"];    [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:allstring];}

Second, the message function of invoking the system

// calling the system mailbox    [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@ "mailto://[email protected] "]];

Third, safari that calls the system

   [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@ "http://www.baidu.com" ]];

Iv. calling the system's SMS kinetic energy

1, this function to carry out some related configuration operation

1) Add Messageui.framework

2) Import header file

#import <MessageUI/MFMessageComposeViewController.h>

3) Compliance with the agreement

<MFMessageComposeViewControllerDelegate>

//call to send SMS method[Self sendsms:@"101"recipientlist:@[@"10010"]];//content, recipient list- (void) Sendsms: (NSString *) bodyofmessage recipientlist: (Nsarray *) recipients{Mfmessagecomposeviewcontroller*controller =[[Mfmessagecomposeviewcontroller alloc] init]; if([Mfmessagecomposeviewcontroller Cansendtext]) {controller.body=Bodyofmessage; Controller.recipients=recipients; Controller.messagecomposedelegate=Self ;    [Self Presentviewcontroller:controller animated:yes completion:nil]; }    }//processing the results of a response sent out- (void) Messagecomposeviewcontroller: (Mfmessagecomposeviewcontroller *Controller Didfinishwithresult: (messagecomposeresult) result{[self dismissviewcontrolleranimated:yes    Completion:nil]; if(Result = =messagecomposeresultcancelled) NSLog (@"Message cancelled"); Else if(Result = =messagecomposeresultsent) NSLog (@"Message sent"); ElseNSLog (@"Message failed"); }

Tip: These functions of calling the system need to be tested on the real machine!

system function calls

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.