Unity Apple登录接入

本文介绍了如何在Unity中集成Apple的SignInWithApple功能,包括从Unity Asset Store下载插件,配置苹果开发者中心,遵循Apple的UI指南添加登录按钮,以及处理登录事件。同时,注意需检查iOS版本以确保兼容性。
摘要由CSDN通过智能技术生成

Unity Apple登录接入

引言

在2019年6月份的全球开发者大会(WWDC)上,苹果宣布了一款新产品:Sign In With Apple。随后苹果更新了App Store审查指南,现在他们要求任何使用第三方或者社交登录服务的新App提供与Apple相同的登录选项,也就是说,你的app上有第三方登录,就必须接入苹果登录Sign In With Apple。

相关链接

开发者中心:登录 - Apple

官方文档:使用入门 - 通过 Apple 登录 - Apple Developer

登录按钮要求:Introduction - Sign in with Apple - Technologies - Human Interface Guidelines - Design - Apple Developer

步骤

1、在unity Asset Store中下载Sign In With Apple Unity Plugin,下载完成之后导入工程。

在这里插入图片描述

2、在苹果开发者中心,找到对应的app,开启sign in with apple功能。

3、在项目中合适位置添加Apple登录图标,需要遵循苹果官方文档。

4、添加登录事件即可。导入的工程中有实例工程,可以尝试以下。


    private void SignInWithApple()
    {
        var loginArgs = new AppleAuthLoginArgs(LoginOptions.IncludeEmail | LoginOptions.IncludeFullName);
        
        this._appleAuthManager.LoginWithAppleId(
            loginArgs,
            credential =>
            {
                // If a sign in with apple succeeds, we should have obtained the credential with the user id, name, and email, save it
                PlayerPrefs.SetString(AppleUserIdKey, credential.User);
                this.SetupGameMenu(credential.User, credential);
            },
            error =>
            {
                var authorizationErrorCode = error.GetAuthorizationErrorCode();
                Debug.LogWarning("Sign in with Apple failed " + authorizationErrorCode.ToString() + " " + error.ToString());
                this.SetupLoginMenuForSignInWithApple();
            });
    }

注意问题

1、需要注意判断ios的版本号,小于13是不支持这个功能的。
CSDN开发云

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

淡定九号

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值