[iOS FAQ] about using QQ to do third-party login issues!
Note:QQ itself does not have authorization function, so want to use QQ to do third-party login must through the QQ space to achieve!
The first step: integration of the SHARESDK (the same steps as integration sharing, if it has been integrated without re-integration), it is important to note that, because it is through the QQ space to achieve authorization login, So when you download the SHARESDK package, do not forget to check the QQ space, or will be reported not yet imported platform (6) error.
The second step: Open the Project *APPDELEGATE.M (* on behalf of your project name)? file, import qqsdk header file: #import <TencentOpenAPI/QQApiInterface.h> #import <TencentOpenAPI/TencentOAuth.h> CheckWhether you have joined the Handleopenurl processing method, and if not, add the following code: -(BOOL)Application: (UIApplication*)Application Handleopenurl: (Nsurl *)Url { return[SHARESDK Handleopenurl:Url Wxdelegate:Self }
-(BOOL)Application: (UIApplication*)Application OpenURL: (Nsurl*)Url Sourceapplication: (NSString*)Sourceapplication Annotation: (ID)Annotation { return[SHARESDK Handleopenurl: Url Sourceapplication:Sourceapplication Annotation: Annotation Wxdelegate: Self } Step Three:Join the QQ space initialization method inside the *APPDELEGATE.M. - (BOOL)application: (uiapplication *)Application Didfinishlaunchingwithoptions: (nsdictionary *)launchoptions{} method Initialize our SDK [sharesdk Registerapp:@ "iosv1101"]; Add a QQ space app [SHARESDK Connectqzonewithappkey:@ "100371282" Appsecret:@ "AED9B0303E3ED1E27BAE87C33761161D" Qqapiinterfacecls:[Qqapiinterface class] Tencentoauthcls:[Tencentoauth class;
Note: The appkey that you need to fill in here is the Appid,appsecret that you registered with the QQ Internet application appkey!
Fourth Step:Configure the URL of the QQ space schemes
Open *-info.plist (* on behalf of your project name). Locate the URL types configuration item (if not added), expand the URL Types–url schemes, add a new scheme for QQ space under URL schemes (if not added, it will result in the return of the application). Its fill in the format: Tencent+appid (you apply in the QQ space AppID), such as: tencent100371282.
Fifth Step:authorize login and get user information
in your Click event method, add the authorization to get the user information interface:
[SHARESDK Getuserinfowithtype:Sharetypeqqspace Authoptions:Nil Result:^(BOOLresult, id<issplatformuser> UserInfo, id<icmerrorinfo> error){
if(Result) { //Print output user uid: nslog (@ "UID =%@ ", [UserInfo uid]); //Print Output user nickname: nslog (@ "name =%@", [UserInfo nickname]); //Print out user avatar Address: nslog (@ "icon =%@", [UserInfo profileimage]); }else{
NSLog (@ "Authorization failed!error code = =%d, error code = =%@", [Error ErrorCode], [error errordescription]); } }]; Note:Sharetypeqqspace here must be write qqspace can't write QQ otherwise will be reported does not support the authorization function error. This is only done in the result output operation if you want to do the storage data or other display can be operated here!
|
[iOS FAQ] about using QQ to do third-party login issues!