第三方登录现在已经成为了主流的登录方式,为了给自家用户带来更好的跨平台与跨设备体验,
苹果在今年的 WWDC2019 推出了属于自己的第三方登录服务 —— Sign in with Apple( iOS 13 及以上可用 )
官方介绍:
https://developer.apple.com/cn/news/?id=09122019b
https://developer.apple.com/cn/sign-in-with-apple/get-started/
接入参考(客户端):
https://mp.weixin.qq.com/s/FYLmFnuaq4DIEyvhgsE_zA
https://blog.csdn.net/n603482184/article/details/101444924
接入参考(服务端):
https://blog.csdn.net/wpf199402076118/article/details/99677412
https://mp.weixin.qq.com/s/xkxCnKqA0u-guEYcYCkcOg
难度指数:★☆☆☆☆
开发及运行环境: macOS 10.14.4 / Xcode 11 / iOS 13
开启苹果登录
- 在苹果开发者后台为应用开启苹果登录功能,具体参考上面的“接入参考(服务端)”
- 在项目工程中添加该功能
代码接入测试
GFAppleLoginManager.h
#import <Foundation/Foundation.h>
typedef void (^GFAppleLoginSuccessBlock)(NSString * userId, NSString * authCode, NSString * identityToken);
typedef void (^GFAppleLoginFailureBlock)(NSError * error);
@interface GFAppleLoginManager : NSObject
@property (nonatomic, assign, readonly) BOOL enable;
+ (instancetype)sharedManager;
- (void)login:(GFAppleLoginSuccessBlock)successBlock error:(GFAppleLoginFailureBlock)failureBlock;
@end
GFAppleLoginManager.m
#import "GFAppleLoginManager.h"
#import <AuthenticationServices/AuthenticationServices.h>
API_AVAILABLE(ios(13.0))
@interface GFAppleLoginManager