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> ; 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.)