iOS 第三方登入之 微信登入

2021-07-07 07:44:21 字數 1792 閱讀 5013

**:

ios開發工具包64位

"    

文件中介紹:

下面咱們就來實現。

-(void) onresp:(baseresp*)resp

else  }

mynslog(@"title:%@",strtitle); }

2.新增wxloginclass.h檔案,內容為: //

//  wxloginclass.h //

#import

@class

wxloginclass;

@protocol wxlogindelegate

@required

-(void) wxlogin:(wxloginclass*) wxloginclass  result:(nsdictionary*) resultdic;

@end

@inte***ce wxloginclass :nsobject

@property (assign)id

delegate;

@property(nonatomic,strong)

uiviewcontroller

* currentvc;

- (instancetype)initwithviewcontroller:(uiviewcontroller*) vc;

-(void) startauthorize;

@end

新增wxloginclass.m檔案,內容為://

//  wxloginclass.m //

#import "wxloginclass.h"

@inte***ce

wxloginclass()

@end

@implementationwxloginclass

- (instancetype)initwithviewcontroller:(uiviewcontroller*) vc

returnself;}

-(void) dealloc

#pragma mark ------- 1. 

調起授權

------

-(void) startauthorize

獲取accesstoken ------

-(void) getwxloginnoti:(nsnotification*) noti//收到通知,進行下一步,獲取accesstoken

else }

-(void)accesstokenrequest:(nsstring*) code

elseelse }

}); }

----

-(void)getwxuserinfo:(nsstring*)userinfo_url

else }

}); }

@end

在.m檔案中

包含標頭檔案

#import "wxapi.h"

#import "wxloginclass.h"

@property

(nonatomic

,strong

) wxloginclass

* wxloginclass;

- (ibaction)touchwechatbutton:(id)sender

#pragma mark

#pragma mark - wxlogindelegate

-(void) wxlogin:(wxloginclass *)wxloginclass result:(nsdictionary *)resultdic

iOS微信第三方登入

2.匯入對應的庫 置應用間的跳轉 4.就說明沒有針對ios9 增加白名單。2 單例介面 import wxapi.h inte ce uiresponder wxapidelegate property strong nonatomic nsstring access token property ...

第三方登入 微信登入流程

可以選擇從友盟 1 開發者資質認證,認證有效期 一年,有效期最後三個月可申請年審即可續期 審核費用 中國大陸地區 300元,非中國大陸地區 120美元。2 管理中心進行應用配置 1.應用名稱 簡介 官網位址 應用 28 28畫素,108 108畫素,僅支援png格式,大小都不超過300kb 2.應用...

ios 第三方登入

ios 第三方登入通常的做法是,1.登入後,獲得第三方的uid,呼叫伺服器登入介面,如伺服器返回無此使用者,轉2,有此使用者,轉3.2.伺服器返回無此使用者,需完善使用者資料,如果完成,則在伺服器建立與第三方uid對應的使用者。3.登入成功。以微博登入為例,登入後得到uid和accesstoken,...