IOS: Friends League SDK third-party login, share and use of Friends League statistics

Source: Internet
Author: User

Tag:ios    friend    sdk   

#import "UMSocial.h" #import "UMSocialWechatHandler.h" #import "UMSocialQQHandler.h" #import "UMSocialSinaHandler.h"/ /Friends League statistics//AU statistical analysis is a professional mobile application statistical analysis tool, is committed to providing developers with real-time, stable mobile application statistics and Analysis Services to help developers better understand users, optimize products and improve conversion rate. Friends Alliance statistical Analysis client, can be convenient for developers to view application data, anytime, anywhere to grasp the operational status of the application. [mobclickstartwithappkey:kumengkeyreportpolicy:send_on_exitchannelid:nil];/////opens Friends League statistics [MobClick setAppVersion: Xcodeappversion]; [Mobclick checkupdate];//Allies authorization [umsocialdata setappkey:kumengkey];//set AppID, set share URL, default to use Friends alliance URL [ Umsocialwechathandler setwxappid:kwxappid appsecret:kwxappkey url:@ "http://www.yshow.net"];//open the SSO switch on Sina Weibo [ Umsocialsinahandler openssowithredirecturl:@ "http://www.yshow.net"];//settings to share to the QQ space app ID, and share the URL link [umsocialqqhandler Setqqwithappid:kqqappid appkey:kqqappkey url:@ "http://www.yshow.net"];//settings support the use of SSO authorization without clients [Umsocialqqhandler setsupportwebview:yes];/** here processing Sina Weibo SSO authorization after jump back, and share completed after jump back */-(BOOL) Application: (UIApplication *) application OpenURL: (nsurl *) URL sourceapplication: (NSString *) sourceapplication annotation: (ID) annotation{return [UMSocialsnsservice Handleopenurl:url Wxapidelegate:nil];} /** here processing Sina Weibo SSO authorized to enter the Sina Weibo client back into the background, and then return to the original application */-(void) applicationdidbecomeactive: (uiapplication *) application{[ Umsocialsnsservice applicationdidbecomeactive];}

#import "UMSocial.h"//QQ Login-(void) Qqbtnclick: (UIButton *) btn{nsstring *platformname = [Umsocialsnsplatformmanager get    SNSPLATFORMSTRING:UMSOCIALSNSTYPEMOBILEQQ];    Umsocialsnsplatform *snsplatform = [Umsocialsnsplatformmanager getsocialplatformwithname:umsharetoqq]; Snsplatform.loginclickhandler (Self,[umsocialcontrollerservice defaultcontrollerservice],yes,^ (        Umsocialresponseentity *response) {NSLog (@ "Login response is%@", response); Get Weibo username, uid, token, etc. if (Response.responsecode = = umsresponsecodesuccess) {umsocialaccountentity *snsac            Count = [[Umsocialaccountmanager socialaccountdictionary] valueforkey:platformname]; NSLog (@ "username is%@, UID was%@, token is%@,iconurl is%@", Snsaccount.username,snsaccount.usid,snsaccount.accesstoken        , Snsaccount.iconurl); }    });} Sina Login-(void) Sinabtnclick: (UIButton *) btn{nsstring *platformname = [Umsocialsnsplatformmanager getsnsplatformstring    : Umsocialsnstypesina]; Umsocialsnsplatform*snsplatform = [Umsocialsnsplatformmanager Getsocialplatformwithname:umsharetosina]; Snsplatform.loginclickhandler (Self,[umsocialcontrollerservice defaultcontrollerservice],yes,^ (       Umsocialresponseentity *response) {NSLog (@ "response is%@", response); if (Response.responsecode = = umsresponsecodesuccess) {umsocialaccountentity *snsaccount = [[UMSocialAccountMana]           GER Socialaccountdictionary] Valueforkey:platformname];       NSLog (@ "=========%@", Snsaccount.accesstoken); }    });} Implement callback Method-(void) Didfinishgetumsocialdatainviewcontroller: (umsocialresponseentity *) response{if ( Response.viewcontrollertype = = Umsviewcontrolleroauth) {NSLog (@ "didfinishoauthandgetaccount response is%@", respon    SE); }}

Share typedef enum{Shareqzone, Shareqqfriend, Shareweixinfriend, SHAREQQWB, Sharesinawb,}sharemode; #import " UMSocialSnsService.h "#import" UMSocialSnsPlatformManager.h "#import" UMSocial.h "-(void) Sharefootviewsurebtndidclick: (Yssharefootview *) View index: (sharemode) index{nsstring *sharetext = @ "Wallpaper Papehome.             Http://www.wallPaper.com/social ";          Share inline text UIImage *shareimage = [[Sdimagecache Sharedimagecache] imageFromDiskCacheForKey:self.sharedImgUrl]; Share inline images//If you get the share completion callback, you need to set delegate to self//@param snsnames the type of SNS platform you want to share, the Nsarray value is ' UMSocialSnsPlatformManager.h ' fixed A string constant of the platform name, with Umsharetosina,umsharetotencent,umsharetorenren,umsharetodouban,umsharetoqzone,umsharetoemail, Umsharetosms, etc. [Umsocialsnsservice presentsnsiconsheetview:self appkey:kumengkey sharetext:sharetext shareImage: Shareimage Sharetosnsnames:@[umsharetoqzone,umsharetoqq,umsharetowechatsession,umsharetotencent,umsharetosina]    Delegate:self]; return;} Below is a callback for sharing completed-(void)Didfinishgetumsocialdatainviewcontroller: (umsocialresponseentity *) response{NSLog (@ "    Didfinishgetumsocialdatainviewcontroller with response is%@ ", response); Based on ' responsecode ' get sent results if sharing success if (Response.responsecode = = umsresponsecodesuccess) {//Get shared to Weibo platform name NS    Log (@ "Share to SNS name is%@", [[Response.data AllKeys] objectatindex:0]); }}

IOS: Friends League SDK third-party login, share and use of Friends League statistics

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.