安装 GCM 时,“'Pods' 目标具有包含静态二进制文件的传递依赖项”

'The 'Pods' target has transitive dependencies that include static binaries' when installing GCM

我正在尝试为我的 iOS 应用程序安装 Google 云消息传递(使用 swift)。我已经像这样将它添加到我的 Podfile 中:

# Uncomment this line to define a global platform for your project
# platform :ios, '8.2'
use_frameworks!

target 'Project' do
    pod 'Alamofire', '~> 1.2'
    pod 'Google/CloudMessaging'
end

target 'ProjectTests' do

end

现在,当我尝试安装依赖项时,出现错误(见下文)。在我添加 GoogleCloudMessaging 之前它运行良好。我尝试创建一个新项目并将其添加到那里而不是查看它是否有效,但我遇到了同样的错误。

Analyzing dependencies
Downloading dependencies
Installing Alamofire (1.2.3)
Installing GGLInstanceID (1.0.0)
Installing Google (1.0.7)
Installing GoogleCloudMessaging (1.0.3)
Installing GoogleInterchangeUtilities (1.0.0)
Installing GoogleNetworkingUtilities (1.0.0)
Installing GoogleSymbolUtilities (1.0.0)
Installing GoogleUtilities (1.0.1)
[!] The '<Project name>' target has transitive dependencies that include static binaries: (/Users/User/Documents/Test/Pods/GGLInstanceID/Libraries/libGGLInstanceIDLib.a, /Users/User/Documents/Test/Pods/Google/Libraries/libGGLCloudMessaging.a, /Users/User/Documents/Test/Pods/Google/Libraries/libGGLCore.a, /Users/User/Documents/Test/Pods/GoogleCloudMessaging/Libraries/libGcmLib.a, /Users/User/Documents/Test/Pods/GoogleInterchangeUtilities/Libraries/libProtocolBuffers.a, /Users/User/Documents/Test/Pods/GoogleNetworkingUtilities/Libraries/libGTMSessionFetcher_full.a, /Users/User/Documents/Test/Pods/GoogleNetworkingUtilities/Libraries/libGTMSessionFetcher_core.a, /Users/User/Documents/Test/Pods/GoogleSymbolUtilities/Libraries/libGSDK_Overload.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_iPhone.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_core.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_UIFont+LineHeight.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_SystemVersion.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_StringEncoding.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_RoundedRectPath.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_Regex.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_NSStringXML.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_NSStringHTML.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_NSScannerJSON.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_NSDictionary+URLArguments.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_KVO.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_GTMURLBuilder.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_DebugUtils.a, /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTM_AddressBook.a, and /Users/User/Documents/Test/Pods/GoogleUtilities/Libraries/libGTMStackTrace.a)

知道如何解决这个问题吗?是否可以在没有 Cocoapods 的情况下安装 GCM?

更新

使用 Cocoapods V 0.38.2 现在可以使用 GMC,或任何其他 Objective-C 框架与 Swift 框架,如 Alamofire

确保在 podfile

中使用 use_frameworks!
# Uncomment this line to define a global platform for your project
# platform :ios, '8.2'
use_frameworks!

target 'Project' do
    pod 'Google'
    pod 'Google/CloudMessaging'
    pod 'Alamofire'
end

target 'ProjectTests' do

end

旧答案

我也在使用 Swift 项目,我只使用 Objective-C 框架,因为 Swift & Objective-C 框架还不适合我.

尝试仅在没有 use_frameworks! 且没有 Alamofire 框架(用 Swift 编写)的情况下安装 GCM

# Uncomment this line to define a global platform for your project
# platform :ios, '8.2'

target 'Project' do
    pod 'Google'
    pod 'Google/CloudMessaging'
end

target 'ProjectTests' do

end

我 运行 在桥接头文件中导入 GCM 时遇到了一些问题。我很好奇你是否遇到了同样的问题。

当 BridingHeader 或 GGLInstanceIDDelegate 不工作时 Google Cloud Messaging 的解决方案是安装 'Google' pod 'Google'

Google/CloudMessaging pod 本身有问题。由于某些静态依赖性,此 pod 无法构建为框架。您可以尝试 Carthage 来构建您的 swift 依赖项。

我在 Google/Analytics pod 上遇到了同样的问题。

这个问题可能会在最新版本的 CocoaPods 中得到解决。

看这个: https://github.com/CocoaPods/CocoaPods/issues/3194

我遇到了类似的问题。我的广告连播是 0.37.2 。如 https://github.com/googlesamples/google-services/issues/22 中所述,我已更新至 0.38.2。解决了。

删除警告中显示的 pod 并解决问题