Apple Unity Plugins 接入GameCenter 崩溃解决方案

问题

  • 调用 GKLocalPlayer.Local.FetchItems() 程序崩溃,报错:Thread 1: EXC_BAD_ACCESS (code=257, address=0x8000000000000002)
    在这里插入图片描述
  • 启动崩溃,报错:Library not loaded: @rpath/AppleCoreNative.framework/AppleCoreNative
    在这里插入图片描述

问题原因

苹果官方提供的库,直接编译后,会在调用 GKLocalPlayer.Local.FetchItems() 时崩溃。
https://github.com/apple/unityplugins

编译库的时候遇到Unity版本不匹配问题,我尝试了应该可以通过修改源码这里的Unity版本解决掉。但是即使编译出来的包也是无法使用的,可能会造成上面两种崩溃
在这里插入图片描述

解决方案

大神已经帮助我们找到问题了。
使用如下命令,解决掉了苹果插件的问题的Commit。
https://github.com/muZZkat/unityplugins

git clone https://github.com/dodgy-ltd/apple-unityplugins.git
cd apple-unityplugins
git remote add muzzkat https://github.com/muZZkat/unityplugins.git
git fetch muzzkat
git merge muzzkat/muzzkat/fix-fetch-items

下载完源码后,根据苹果文档编译源码得到Unity插件包
https://github.com/apple/unityplugins/blob/main/Documentation/Quickstart.md

这个大神已经提了PR,但是没有被合并。目前的方案就用上面的命令
在这里插入图片描述

解决方案来自网上
https://forum.unity.com/threads/apple-unity-plugins-crashing-on-authentication.1450414/
在这里插入图片描述

可直接使用的UnityPlugins

为了编译源码,防止版本不兼容,专门下载了 2020.3.33f1版本的Unity,现将编译后的插件提供在如下仓库,有需要可以直接使用。笔者项目使用的2022Unity,也是兼容的。
https://github.com/liuyongjiesail/AppleUnityPlugins

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

sailip

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

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

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

打赏作者

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

抵扣说明:

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

余额充值