IOS custom Sharing features (share to SAHRESDK, etc.)

Source: Internet
Author: User

This tutorial is done with the official SHARESDK (Follow the tutorial for a pre-preparation operation, the imported import, the addition of the add)

Finish preparatory work and do the following

First of all, the need to share the way to declare

/**     *  share the declaration of the way of reference */    [sharesdk registerapp:@ "3df7a36158b2"];    [Sharesdk connectsinaweibowithappkey:@ "568898243"                               appsecret:@ "38a4f8204cc784f81f9f0daaf31e02e3                             " redirecturi:@ "http://www.sharesdk.cn"];

Choose a way to share and create a shared content

//choose the way to share 
Switch (sender.tag) {case 11:type = sharetypeyixinsession;        Break            Case 12:type = sharetypeyixintimeline;        Break            Case 13:type = sharetypeweixisession;        Break            Case 14:type = sharetypeweixitimeline;        Break            Case 15:type = Sharetypesinaweibo;        Break            Case 16:type = sharetypeqq;        Break            Case 17:type = sharetypeqqspace;        Break            Case 18:type = Sharetyperenren;        Break            Case 19:type = sharetypesms;        Break            Case 20:type = Sharetype163weibo;        Break            Case 21:type = Sharetypetencentweibo;        Break            Case 22:type = sharetypeevernote;        Break            Case 23:type = Sharetypeinstapaper;        Break Case 24:tyPE = sharetypemail;        Break            Case 25:type = sharetypeyoudaonote;        Break            Case 26:type = Sharetypepocket;                    Break    Default:break; }//share content and other parameters id<isscontent> publishcontent = [sharesdk content:userWriteTextView.text defaultcontent:nil image : [Sharesdk Pngimagewithimage:shareimage] title:@ "This is the title" url:@ "http://mob.com" description:@ "This is        description "Mediatype:sspublishcontentmediatypenews";                    2. Share [sharesdk sharecontent:publishcontent type:type authoptions:nil shareoptions:nil StatusBarTips:YES result:^ (sharetype type, ssresponsestate state, id<issplatformshareinfo> StatusInfo, Id<icmerrorinfo&gt ;                  Error, BOOL end) {if (state = = sspublishcontentstatesuccess) {NSLog (@ "shared success"); Uialertview *alert = [[Uialertview alloc]initwithtitle:@ "" message:@ "share Success" delegate:self cancelbuttontitle:@ "OK"Otherbuttontitles:nil];              [Alert show]; } else if (state = = Sspublishcontentstatefail) {NSLog (@ "Share failed, error code:%LD, error description%@", (long) [Error Errorcode],[err                  or errordescription]); Uialertview *alert = [[Uialertview alloc]initwithtitle:@ ' "message:@" sharing failed, see Journal error description "Delegate:self cancelbuttontitle:@                  "OK" otherbuttontitles:nil];              [Alert show]; }          }];}

The following method is to determine whether the user is logged in

</pre><pre name= "code" class= "OBJC" > id<issplatformcredential> credential = [ShareSDK Getcredentialwithtype:sharetypesinaweibo];    if (Credential!=nil&&[credential available]) {         NSLog (@ "is logged in!) ");    } else {         NSLog (@ "is not in the login state!) ");    }





IOS custom Sharing features (share to SAHRESDK, etc.)

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.