【发布时间】:2015-08-26 06:54:57
【问题描述】:
我正在我的 Swift iOS 应用中实现 Google Cloud Messaging。 我正在关注本指南:https://developers.google.com/cloud-messaging/ios/client?ver=swift
首先我更改了 pods 文件,然后运行了 pod install。这工作得很好。 由于 Swift 需要一个桥接头来包含 ObjC 库,我按照指南中的建议扩展了我的标头
#import <Google/CloudMessaging.h>
但导入失败 - 找不到文件。
我注意到 CloudMessaging.h 并不直接在 Google 文件夹中,而是在 Google/CloudMessaging 中。不幸的是
的导入#import <Google/CloudMessaging/CloudMessaging.h>
两者都不起作用。
这是我的 pod 的截图
有人注意到同样的问题吗?有什么想法可以解决吗? 项目构建良好,只是由于找不到标头而找不到 GCM 类。
深入挖掘:
我尝试从头开始添加 CloudMessaging: 我运行 pod init 并将 podfile 更改为
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
target 'Google Cloud Push iOS' do
pod 'Google/CloudMessaging'
end
target 'Google Cloud Push iOSTests' do
end
然后就可以了
如果我使用我的 podfile
source 'https://github.com/CocoaPods/Specs.git'
#platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 1.3'
pod 'ObjectMapper', '~> 0.14'
pod 'AlamofireObjectMapper', '~> 0.7'
pod 'HanekeSwift'
pod 'Google/CloudMessaging'
错误仍然存在
【问题讨论】:
标签: ios swift google-cloud-messaging