2

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

this image in Xcode:

enter image description here

and this Podfile :

enter image description here

how to fix this problem. thanks.

shala7
  • 21
  • 1
  • 5

2 Answers2

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.

Stefan Scoarta
  • 781
  • 9
  • 21
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?

Community
  • 1
  • 1
Andrew Hershberger
  • 4,152
  • 1
  • 25
  • 35