ios-call, send text messages, e-mail "designated QQ users to send QQ message"

Source: Internet
Author: User

1. Send SMS

Header file

#import <MessageUI/MessageUI.h>

Head Agent

@interface Viewcontroller () <MFMessageComposeViewControllerDelegate>

Send Message

- (void) sendermessage{if([Mfmessagecomposeviewcontroller Cansendtext]) {///Instantiation of SMSMfmessagecomposeviewcontroller * MESSAGEVC =[[Mfmessagecomposeviewcontroller alloc] init]; ///target number, can be multipleMessagevc.recipients = @[@"18888888888",@"15555555555"]; MessageVc.navigationBar.tintColor=[Uicolor Redcolor]; Messagevc.body=@"What to send-what to send -what to send"; Messagevc.messagecomposedelegate=Self ;        [Self PRESENTVIEWCONTROLLER:MESSAGEVC animated:yes completion:nil]; [[[[Messagevc Viewcontrollers] lastobject] navigationitem] Settitle:@"title"]; }    Else{NSLog (@"The current device does not support SMS features"); }    }

Proxy method implementation

-(void) Messagecomposeviewcontroller: (Mfmessagecomposeviewcontroller *Controller Didfinishwithresult: (messagecomposeresult) Result {///Dismiss Mfmessagecomposeviewcontroller[Controller Dismissviewcontrolleranimated:yes Completion:nil]; if(Result = =messagecomposeresultsent) {NSLog (@"message sent successfully! "); }    Else if(Result = =messagecomposeresultfailed) {NSLog (@"message sent failed! "); }    Else if(Result = =messagecomposeresultcancelled) {NSLog (@"Click the Cancel"); }    Else{            }}
2. Make a phone call
-(void) dialphone{    /// The method calls directly, does not eject the call (cancel)    [[uiapplication Sharedapplication]openurl:[nsurl urlwithstring:@ "tel://18888888888"];         /// This method pops up whether to cancel the call    Uiwebview*callwebview =[[UIWebView alloc] init];     *telurl =[nsurl urlwithstring:@ "tel:18888888888"];    [Callwebview loadrequest:[nsurlrequest Requestwithurl:telurl];    [Self.view Addsubview:callwebview];}
3. Send mail
-(void) senderemail{    *urlstr =@ "mailto:[email protected]?subject= Message subject (This parameter does not pass) &body= Mail content (this parameter is not transmitted)";     *url = [Nsurl urlwithstring:urlstr];    [[UIApplication sharedapplication] openurl:url];}
4. Send QQ message
-(void) senderqq{    //111111111111 for QQ number    @ "mqq://im/chat ? chat_type=wpa&uin=111111111111&version=1&src_type=web";    [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:url];}

ios-call, send text messages, e-mail "designated QQ users to send QQ message"

Related Article

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.