由于 Cocoapods,Unity 无法使用 firebase 分析编译项目

Unity fails to compile project with firebase analytics because of Cocoapods

我正在尝试将 Firebase-Analytics 集成到我的 Unity 2013.3.1 项目中。

在遵循 integration guide 之后,我尝试构建项目。

但是,Unity 无法构建。原因好像是cocoapods.

Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Firebase/Analytics":
  In Podfile:
    Firebase/Analytics (= 4.8.1)

None of your spec sources contain a spec satisfying the dependency: `Firebase/Analytics (= 4.8.1)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

我尝试重新安装 cocoapods 并重新运行 pod setup,还删除了存储库并使用 rm -rf ~/.cocoapods/repos/master 重新设置,但我没有成功。

这是生成的 Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'

target 'Unity-iPhone' do
pod 'Firebase/Analytics', '4.8.1'
pod 'Firebase/Core', '4.8.1'
end

我尝试的最后一件事是将特定版本标签删除到 Podfile 中(我删除了“4.8.1”)。这修复了 pod install,但是 我找不到从 unity 成功构建的方法,因为 Podfile 是自动生成的

这是删除版本标签后的 pod 安装输出:

Analyzing dependencies
Downloading dependencies
Installing Firebase (4.9.0)
Installing FirebaseAnalytics (4.0.9)
Installing FirebaseCore (4.0.15)
Installing FirebaseInstanceID (2.0.9)
Installing GoogleToolboxForMac (2.1.3)
Installing nanopb (0.3.8)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `Unity-iPhone.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 6 total pods installed.

看起来 FirebaseAnalytics 目前的版本是 4.0.9,而不是 4.8.1。

有没有人遇到过类似的问题?

Firebase 4.9 使用的 FirebaseAnalytics 版本是 4.0.9,不是 4.8.1。 See the podspec for reference.

另一个可能导致失败的问题是您的依赖项 (iOS 7) 太旧,Xcode 9 和最新版本的 Firebase 都不支持它。

替换

platform :ios, '7.0'

platform :ios, '8.0'

更新至 4.4.2 release

或使用 4.4.1 解决方法:

手动编辑了 Assets/Firebase/Editor 中的每个 Dependencies.xml 个文件,将版本从 4.8.1 更改为 4.8.2。示例:

  <iosPods>
  <!-- Mike changed this from 4.8.1 to 4.8.2 -->
    <iosPod name="Firebase/Analytics" version="4.8.2" minTargetSdk="7.0">
    </iosPod>
  </iosPods>

参考和其他详细信息here