Friend Alliance Third Party Login

Source: Internet
Author: User

First, in the project to configure AppID and Appkey

#import "ViewController.h"#import "UMSocial.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload];}#pragmaMark-third-party login-(ibaction) sinalogin {umsocialsnsplatform*snsplatform =[Umsocialsnsplatformmanager Getsocialplatformwithname:umsharetosina]; Snsplatform.loginclickhandler (Self,[umsocialcontrollerservice Defaultcontrollerservice],yes,^ (Umsocialresponseentity *response) {        //access to Weibo usernames, uid, tokens, etc.        if(Response.responsecode = =umsresponsecodesuccess) {umsocialaccountentity*snsaccount =[[Umsocialaccountmanager socialaccountdictionary] Valueforkey:umsharetosina]; NSLog (@"username is%@, UID was%@, token is%@ URL is%@", Snsaccount.username,snsaccount.usid,snsaccount.accesstoken,snsaccount.iconurl); }});}-(ibaction) qqlogin {umsocialsnsplatform*snsplatform =[Umsocialsnsplatformmanager GETSOCIALPLATFORMWITHNAME:UMSHARETOQQ]; Snsplatform.loginclickhandler (Self,[umsocialcontrollerservice Defaultcontrollerservice],yes,^ (Umsocialresponseentity *response) {        if(Response.responsecode = =umsresponsecodesuccess) {umsocialaccountentity*snsaccount =[[Umsocialaccountmanager socialaccountdictionary] valueforkey:umsharetoqq]; NSLog (@"username is%@, UID was%@, token is%@ URL is%@", Snsaccount.username,snsaccount.usid,snsaccount.accesstoken,snsaccount.iconurl); }});}#pragmaMark-Share-(ibaction) sharetosession {[Self sharetoweixin:umsharetowechatsession];}-(ibaction) sharetotimeline {[Self sharetoweixin:umsharetowechattimeline];}- (void) Sharetoweixin: (NSString *) sharetoweixin{UIImage*image = [UIImage imagenamed:@"dzq_icon.jpg"]; [[Umsocialdataservice Defaultdataservice] postsnswithtypes:@[sharetoweixin] Content:@"The dream still has to have, in case the realization of it"Image:image location:nil urlresource:nil presentedcontroller:self completion:^ (umsocialresponseentity *response) {        if(Response.responsecode = =umsresponsecodesuccess) {NSLog (@"Share Success! "); }    }];}

Friend Alliance Third Party Login

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.