1.在开发平台Certificates, Identifiers & Profiles中找到项目的Identifiers 勾选Sign in with Apple
2.在项目中将Sign in with Apple 加入项目
在flutter项目的pubspec.yaml中添加依赖
dependencies:
sign_in_with_apple: ^3.3.0
登录核心代码:
//核心就这一个方法,去获取登录用户信息
AuthorizationCredentialAppleID credential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
);
if (credential != null) {
bindApple(credential.userIdentifier!);
//获取的信息
}
最后关于苹果登录按钮设计标准参考官方文档信息:
https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/