Swift iOS不识别GCM库导入? [英] Swift iOS don't recognize GCM library imports?

查看:142
本文介绍了Swift iOS不识别GCM库导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过cocoapods成功下载了GCM sdk,一切都很好。
但Swift无法识别GCM库导入



Xcode中的这张图片:





和这个Podfile:



如何解决这个问题。谢谢。

解决方案

更新:我推荐Stefan Scoarta的 use_frameworks!添加到您的pod文件中。



原始答案:
请确保您已配置桥接标头,如Apple的
在Cocoa和Objective-C中使用Swift 文档。


为了将一组Objective-C文件导入与Swift代码相同的应用程序目标中,您需要依靠Objective-C桥接头将这些文件公开到Swift中......或者,您可以通过选择File> New> File>(iOS或OS X)> Source> Header File。


有一些有用的答案给相关的questi在这里:如何将Cocoapods与Swift项目集成?


I downloaded GCM sdk through cocoapods successfully and everything is fine. But Swift don't recognize GCM library imports

this image in Xcode:

and this Podfile :

how to fix this problem. thanks.

解决方案

Updated: I recommend Stefan Scoarta's answer to add use_frameworks! to your podfile if you're targeting iOS 8 or higher and can use frameworks.

Original answer: Make sure that you've configured a bridging header as described in Apple's Using Swift with Cocoa and Objective-C document.

To import a set of Objective-C files in the same app target as your Swift code, you rely on an Objective-C bridging header to expose those files to Swift…Alternatively, you can create a bridging header yourself by choosing File > New > File > (iOS or OS X) > Source > Header File.

There are some useful answers to a related question here: How to integrate Cocoapods with a Swift project?

这篇关于Swift iOS不识别GCM库导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆