Swift iOS don't recognize GCM library imports?

时光总嘲笑我的痴心妄想 提交于 2020-01-04 18:14:46

问题


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.


回答1:


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?




回答2:


You don't need a bridging header, in your pod file put this use_frameworks!. Then you can import the framework into your swift file.



来源:https://stackoverflow.com/questions/31629768/swift-ios-dont-recognize-gcm-library-imports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!