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