Apple登录
前置条件
添加通过 Apple 登录的按钮。建议参考 Apple 的官方设计规范:
https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple
如果需要支持应用组(App Group)内的共享用户账号,请正确指定主App ID。
添加依赖
- Android
- iOS
- Unity
- Unreal
在应用级别的 build.gradle 中添加以下代码,并将 $msdk_version 替换为实际的 MSDK 版本。
dependencies {
implementation "com.garena.sdk.android:login-apple:$msdk_version"
}
使用方法
- Android
- iOS
- Unity
- Unreal
AccountManager accountManager = new AccountManager(activity);
accountManager.login(PlatformType.APPLE, onLoginListener);
启用 通过 Apple 登录 能力。官方参考文档请查看: https://developer.apple.com/help/account/configure-app-capabilities/about-sign-in-with-apple
注意
通过 Apple 登录 仅支持 iOS 13 及以上版本。对于更低版本的 iOS,建议隐藏通过 Apple 登录按钮,或禁止调用登录 API。
[MSDKLoginManager loginWithPlatform:MSDKePlatformApple completion:^(MSDKLoginRet *loginRet) {
// handle login result
}];
GMSDKHandler.LoginClient.Login(AccountPlatform.Apple, OnLoginCallback);
UMsdkLogin::Login(EPlatform::Apple);
Customize page title
- Android
- iOS
- Unity
- Unreal
accountManager.login(new AppleLoginParams("Apple login test"), onLoginListener);