Google 在 iOS 上玩游戏服务出错

Error with Google Play Game Service on iOS

我收到这个错误:

ERROR: GPGSAppController.mm GIDSignIn.h File not found error

我正在使用 Google Play Game Service plugin for Unity 作为排行榜和成就,在 android 中一切正常,但是当我构建到 IOS 并尝试 运行 我的项目时到 iOS 设备时,我不断收到此错误,现在几个小时都找不到解决方案。

我试图删除与 Google Play 服务相关的所有内容(当然是在创建备份之后),并且该应用程序安装并运行正常,除了它有点滞后,但这是另一个问题。所以我确定问题来自 Google Play 服务,但我不知道如何解决它。我又是 Xcode 和 iOS 开发的新手,甚至 Mac。

我在 Unity 中构建项目后也收到此消息:

TO FINISH CONFIGURING THE EXPORTED XCODE PROJECT

  1. Add these frameworks:

    AddressBook.framework
    AssetsLibrary.framework
    CoreData.framework
    CoreTelephony.framework
    CoreText.framework
    Security.framework
    libc++.dylib
    libz.dylib

  2. Add the following bundles and frameworks from the Google Plus and the Google Play Games C++ SDKs. These can be downloaded from https://developers.google.com/games/services.

    GoogleOpenSource.framework
    GoogleSignId.bundle
    GoogleSignId.framework
    gpg.bundle
    gpg.framework

    Note: Make sure the bundles are copied to application. This can be verified under Build Phases/Copy Bundle Resources.

  3. Add the '-ObjC' linker flag. To do this, select the top-level project object, select the 'Unity-iPhone' build target, then go to the Build Settings tab. Search for Other Linker Flags and add the '-ObjC' flag to that list.

** Note: To run in the simulator, use Unity 4.6.8 or greater.

ios_instructions on plugin repository

但由于不熟悉 iOS 开发,我不知道如何执行上述任何操作。感谢任何帮助。

我也在经历这个,对于 #1,它必须在 xcode 中完成,下面是如何添加这些 libs

的屏幕截图

that 用于 #3

希望对您有所帮助 :) 我会在发现 #2 后回复您 ;)

@aimozs 的回答是正确的,指出了在哪里添加所需的文件,一些 google 搜索给了我答案;

根据说明(对我不起作用,向下滚动)

AddressBook.framework
AssetsLibrary.framework
CoreData.framework
CoreTelephony.framework
CoreText.framework
Security.framework
libc++.dylib
libz.dylib

这些都可以在链接框架的时候直接定位。 (在我的例子中,libc++.dyliblibz.dylib 已经链接了,我无法以某种方式找到它们,但是重新生成你的 xcode 项目应该再次添加这两个。

GoogleOpenSource.framework

我在这里找到了它:
https://developers.google.com/+/mobile/ios/getting-started#step_1_creating_the_console_name_project

GoogleSignId.bundle
GoogleSignId.framework

在以下位置找到它们:
https://developers.google.com/identity/sign-in/ios/sdk/
(我抓到了最新版本Google Sign-In SDK 3.0.0

gpg.bundle
gpg.framework

我在这里找到它们:
https://developers.google.com/games/services/downloads/sdks
(抢到Play Games C++ SDK Version 2.1

此外,消息的以下部分似乎很重要:

Make sure the bundles are copied to application

我试图将包文件复制到项目的根目录,但我仍然遇到同样的错误。

解决方案:CocoaPods 和 podfile!

我在xcode项目目录下看到了PodFile.
干得好;确保您遵循以下步骤: https://github.com/playgameservices/play-games-plugin-for-unity#ios-setup

然后看https://cocoapods.org/

sudo gem install cocoapods
pod repo update
pod install
open Unity-iPhone.xcworkspace

比到处手动复制文件要好得多! ;)

注意:我还必须禁用 bitecode 因为我有一个关于 GoogleOpenSource:

的链接器错误

You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)

编译时好像没有启用bitcode,解决方法在这里:

构建、享受并专注于制作精彩的游戏!

相关问题

这里还有个小讨论:
http://forum.unity3d.com/threads/googleplus-googleplus-h-file-not-found-gpgsappcontroller-mm-xcode.294398/

UnityAnswers 上的类似问题:
http://answers.unity3d.com/questions/1098655/gpgsappcontrollermm-gidsigninh-file-not-found-erro.html