2
This commit is contained in:
@@ -85,8 +85,12 @@ static NSString * const kKBAppleUserIdentifierKey = @"com.company.keyboard.apple
|
||||
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
ASAuthorizationAppleIDCredential *credential = authorization.credential;
|
||||
// 不在本地持久化 userIdentifier,统一交给服务端处理
|
||||
// NSString *userID = credential.user; // 如需本地缓存,请自行决定是否保存
|
||||
// 为了让键盘扩展/主 App 能识别“是否已登录”,在本地持久化 userIdentifier 到钥匙串。
|
||||
// 仅保存一个标记(不包含敏感信息),业务登录态仍以服务端为准。
|
||||
NSString *userID = credential.user ?: @"";
|
||||
if (userID.length > 0) {
|
||||
[self.class keychainSave:kKBAppleUserIdentifierKey value:userID];
|
||||
}
|
||||
if (self.completion) {
|
||||
self.completion(credential, nil);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user