我正在尝试为我的iOS应用程序安装Google Cloud Messaging(使用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?
答案 0 :(得分:6)
使用Cocoapods V 0.38.2,现在可以使用GMC或任何其他Objective-C框架与Alamofire等Swift框架
确保在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&amp; 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'
答案 1 :(得分:2)
我遇到了与Google/Analytics
pod相同的问题。
可以在最新版本的CocoaPods中解决此问题。
答案 2 :(得分:1)
Google / CloudMessaging pod本身存在问题。由于某些静态依赖性,此pod无法构建为框架。您可以尝试使用Carthage来建立快速的依赖关系。
答案 3 :(得分:1)
我有类似的问题。我的吊舱是0.37.2。我在https://github.com/googlesamples/google-services/issues/22中提到的更新为0.38.2。得到了解决。
答案 4 :(得分:-1)
移除警告和问题解决中显示的窗格