Google Analytics v3 Pod与其他Swift Pod

时间:2015-07-29 19:19:01

标签: ios swift google-analytics cocoapods google-analytics-sdk

我正在开发一个快速的iOS应用程序,在这个“最后”阶段,我将添加Google Analytics。

我正在关注他们的Guide

但它在pod install命令失败了......

错误日志
Downloading dependencies Using Alamofire (1.2.2) Using Bolts (1.2.0) Using CryptoSwift (0.0.10) Using FBSDKCoreKit (4.2.0) Using FBSDKLoginKit (4.2.0) Using FBSDKShareKit (4.2.0) Installing Google (1.0.7) Installing GoogleAnalytics (3.13.0) Using GoogleMaps (1.10.1) Installing GoogleNetworkingUtilities (1.0.0) Installing GoogleSymbolUtilities (1.0.0) Installing GoogleUtilities (1.0.1) Using ImageLoader (0.3.2) Using SQLite.swift (0.1.0.pre) Using SwiftyJSON (2.2.0) [!] The 'Pods-<My-Project>' target has transitive dependencies that include static binaries: (<path-to-project-dir>/Pods/Google/Libraries/libGGLAnalytics.a, <path-to-project-dir>/iOS/Pods/Google/Libraries/libGGLCore.a, <path-to-project-dir>/iOS/Pods/GoogleAnalytics/Libraries/libGoogleAnalytics.a, (...)

this tutorial中所述,“用Swift编写的pod必须创建为动态框架”(这就是Podfile中use_frameworks!的原因)。 看起来,这个新的Google Analytics pod是一个静态二进制文件。

我尝试将广告连结更改为与this answer相同,但pod install命令警告我(显然)[!] GoogleAnalytics-iOS-SDK has been deprecated in favor of GoogleAnalytics。而且我不确定将已经弃用的库添加到新项目中,而不是让正确的库工作。

我的项目具有iOS 8.0+的目标依赖性,podfile为:
``` 来源'https://github.com/CocoaPods/Specs.git'
平台:ios,'8.0'
use_frameworks!

目标'MyProject'做

pod'Alamofire','〜&gt; 1.2'
  pod'SwiftyJSON','〜&gt; 2.2.0'
  pod'GoogleMaps'   pod'ImageLoader','〜&gt; 0.3.0'   pod'SQLite.swift',git:'https://github.com/stephencelis/SQLite.swift.git'
  pod'FBSDKCoreKit'
  pod'FBSDKLoginKit'
  pod'FBSDKShareKit'
  pod'CryptoSwift'
  pod'GoogleAnalytics','〜&gt; 3.13'

目标'MyProjectTests'做

端 ```

是否有人遇到同样的问题或者知道如何使用v3 GA pod解决这个问题?

1 个答案:

答案 0 :(得分:2)

替换

pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
使用

在Podfile中

pod 'GoogleAnalytics', '~> 3.13'

清理项目并再次运行pod安装。您当前使用的pod是不推荐使用的pod。