猎豆优选

LDTaobaoAuthorTool.m 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // LDTaobaoAuthorTool.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2019/1/30.
  6. // Copyright © 2019年 kuxuan. All rights reserved.
  7. //
  8. #import "LDTaobaoAuthorTool.h"
  9. #import "LDTaobaoWebAuthorController.h"
  10. #import <AlibabaAuthSDK/ALBBSDK.h>
  11. #import <AlibabaAuthSDK/ALBBSession.h>
  12. @implementation LDTaobaoAuthorTool
  13. + (void)taobaoAuthorManager:(NSString *)url type:(NSString *)authorType currentVc:(UIViewController *)Vc {
  14. if (![[ALBBSession sharedInstance] isLogin]) {
  15. //淘宝未授权
  16. ALBBSDK *albbSDK = [ALBBSDK sharedInstance];
  17. [albbSDK setAppkey:ALBC_APP_KEY];
  18. [albbSDK setAuthOption:NormalAuth];
  19. [albbSDK auth:Vc successCallback:^(ALBBSession *session){
  20. LDTaobaoWebAuthorController *webAutuhor = [[LDTaobaoWebAuthorController alloc] init];
  21. webAutuhor.url = url;
  22. webAutuhor.authorType = authorType;
  23. [Vc.navigationController pushViewController:webAutuhor animated:YES];
  24. } failureCallback:^(ALBBSession *session,NSError *error){
  25. NSLog(@"session == %@,error == %@",session,error);
  26. }];
  27. }else {
  28. LDTaobaoWebAuthorController *webAutuhor = [[LDTaobaoWebAuthorController alloc] init];
  29. webAutuhor.url = url;
  30. webAutuhor.authorType = authorType;
  31. [Vc.navigationController pushViewController:webAutuhor animated:YES];
  32. }
  33. }
  34. @end