支付宝授权

 

按照集成文档https://opendocs.alipay.com/open/218/sxc60m#SDK集成

 

  1. 在 Build Phases 选项卡的 Link Binary With Libraries 中,增加以下依赖:AFServiceSDK

  2. 增加头文件引用:import <AFServiceSDK/AFServiceSDK.h>

服务调用

- ( void )demoAuth { NSDictionary *params = @{kAFServiceOptionBizParams: @{ @"url" : @"https://authweb.alipay.com/auth?auth_type=PURE_OAUTH_SDK&app_id=2016051801417322&scope=auth_user&state=xxx" }, kAFServiceOptionCallbackScheme: @"apsdkdemo" , }; [AFServiceCenter callService:AFServiceEInvoice withParams:params andCompletion:^(AFServiceResponse *response) { NSLog ( @"%@" , response.result); }]; }

回跳 URL 处理

- ( BOOL )application:( UIApplication *)application openURL:( NSURL *)url sourceApplication:( NSString *)sourceApplication annotation:( id )annotation { if ([url.host isEqualToString: @"apmqpdispatch" ]) { [AFServiceCenter handleResponseURL:url withCompletion:^(AFServiceResponse *response) { if (AFResSuccess == response.responseCode) { NSLog ( @"%@" , response.result); } }]; } return YES ; } - ( BOOL )application:( UIApplication *)app openURL:( NSURL *)url options:( NSDictionary < NSString *, id > *)options { if ([url.host isEqualToString: @"apmqpdispatch" ]) { [AFServiceCenter handleResponseURL:url withCompletion:^(AFServiceResponse *response) { if (AFResSuccess == response.responseCode) { NSLog ( @"%@" , response.result); } }]; return YES ; } return YES ; }

 

参考链接

https://www.jianshu.com/p/884538337ae3

https://opendocs.alipay.com/open/009ys9#Android%20%C2%A0SDK_4

https://opendocs.alipay.com/open/284/105810

https://opendocs.alipay.com/mini/introduce/getphonenumber

https://opendocs.alipay.com/open/284/web

https://opendocs.alipay.com/open/218/sxc60m#SDK集成

https://opendocs.alipay.com/open/01g6qm#iOS%20%C2%A0SDK_2

 

posted on 2016-05-03 10:52  &#127774;Bob  阅读(347)  评论(0编辑  收藏  举报

导航