Call system in iOS to make a phone call to send a text message

Source: Internet
Author: User

First, call the call interface

[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:[nsstring stringwithformat:@ "tel://%@", _ PhoneNumber]];

Second, send the short message interface

Call the system to send SMS interface, need to introduce the following header file:

#import <MessageUI/MessageUI.h>

The call of the system SMS interface is very simple, just the following lines of code:

?
12345          MFMessageComposeViewController * con = [[MFMessageComposeViewController alloc]init];            if ([MFMessageComposeViewController canSendText]) {                [email protected][_phoneNumber];//电话数组                con.messageComposeDelegate=self;                [self presentViewController:con animated:YES completion:nil];

Here are some common ways to summarize Messageui:

+ (BOOL) cansendtext

Determine if text is supported

+ (BOOL) cansendsubject;

To determine whether to support sending topic information

+ (BOOL) cansendattachments;

Determine whether to support sending attachments

+ (BOOL) Issupportedattachmentuti: (NSString *) UTI;

Determine whether to support the unified labeling attachment

-(void) disableuserattachments;

Prohibit sending attachments

@property (nonatomic,copy) Nsarray *recipients;

Contact Group, displayed in the sender list

@property (nonatomic,copy) NSString *body;

Information body Content

@property (nonatomic,copy) NSString *subject;

Information title

@property (Nonatomic,copy, readonly) Nsarray *attachments;

Information attachment array read-only inside is a dictionary

-(BOOL) Addattachmenturl: (Nsurl *) Attachmenturl withalternatefilename: (NSString *) alternatefilename;

Returns YES for Add success based on URL path and add attachment

-(BOOL) Addattachmentdata: (NSData *) attachmentdata typeidentifier: (NSString *) UTI filename: (nsstring *) filename;

Add attachments based on data

-(void) Messagecomposeviewcontroller: (Mfmessagecomposeviewcontroller *) controller didfinishwithresult: ( Messagecomposeresult) result;

Mfmessagecomposeviewcontrollerdelegate's proxy method, result returns a result, enumerated as follows:

?
12345678 enumMessageComposeResult {    //取消发送    MessageComposeResultCancelled,    //发送成功    MessageComposeResultSent,    //发送失败    MessageComposeResultFailed};

Call system in iOS to make a phone call to send a text message

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.