1.引入包
sign_in_with_apple: ^3.0.0
2.ios相关配置
在apple开发者中心点击Certificates, Identifiers & Profiles下的Identifiers,勾选Sign in with Apple
在xcode中依次点击:左侧根目录Runner--》TARGETS下的Runner--》Signing & Capabilities--》添加Sign in with Apple
3.代码
GestureDetector(
onTap: () async {
final credential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
);
if (credential != null) {
// appleLogin为apple登录逻辑
appleLogin(credential.identityToken);
}
},
)
本文介绍了如何在Flutter应用中集成AppleSignIn功能。首先,引入sign_in_with_apple包版本3.0.0,然后在Apple开发者中心配置Identifiers。接下来,在Xcode中为项目启用SigninwithApple。在代码段中展示了使用GestureDetector监听用户点击,调用signInWithApple获取凭证,并处理登录逻辑。
667

被折叠的 条评论
为什么被折叠?



