Joke Collection Website - Public benefit messages - How to use the system's MFMessageComposeViewController to send short messages?

How to use the system's MFMessageComposeViewController to send short messages?

How to use the system message to send SMS 1, and import the package MessageUI.framework2, the main content (1). Code topic part mfmessagecomposer controller * controller = [[mfmessagecomposer controller] init]; //Before presenting the message composition view, call the canSendText class method to ensure that the user's device configuration is correct. If ([mfmessagecompositeviewcontrollercan send text]) {//message controller. body = the initial content of message; //An array of strings containing the initial recipients of the message. Controller.recipients = substring; //Proxy method controller. MessageCompositedelegate = self [self presentmodalviewcontroller: controller animation: Yes]; (2) Execute the proxy method//Tell the entrusting user that the message has been written-(Void) Message Composer Controller: (mfmessage composer controller *) Controller Diffinishwith Result: (Message ComposeResult) Result {[SelfdismModelViewControllerAnimated: Yes]; If (result = = Message Composed Resulted) nslog (@ "Message cancelled"); else if(result = = MessageComposeResultSent)NSLog(@“Message sent”); Else NSLog(@ "Message Failed"); } Summary: (1) Before sending short messages, it is necessary to verify whether the device has the ability to send short messages. (2) Attribute message is the content of short message. (3) The attribute menu is the sender information of short messages. Please note that its type is nsarray2013-01-02 Shangdao.