cmii
cmii

Reputation: 3636

error using cocoapods "use_frameworks!" SWIFT

I had a clean swift project, using some cocoapods : Parse, AFNetworking and RESideMenu. I need to use STZPopupView pod, so I updated cocoapods with the last version:

gem install cocoapods

Then I relaunched it for my project:

pod install

Because of this error :

[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.

I updated my podfile adding "use_frameworks!"

My podfile is now:

# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

target 'isam' do
pod 'RESideMenu', '~> 4.0.7'
pod 'AFNetworking', '~> 2.5'
pod 'Parse', '~> 1.6'
pod 'STZPopupView', '~> 1.0'
end

target 'isamTests' do

end

Since, I have 2 errors when I build :

I didn't changed anything else in my project.

My Swift-Bridging-Header.h doesn't change :

#ifndef isam_Swift_Bridging_Header_h
#define isam_Swift_Bridging_Header_h

#import <Parse/Parse.h>
#import <RESideMenu.h>

#endif

In my build settings, I have :

builds settings

I think it's because of "use_frameworks!" in my podfile, but I don't know how to do to use all of my pods to build my app correctly.

EDIT :

The exact errors are :

/path_of_my_project/Swift-Bridging-Header.h:12:9: error: 'RESideMenu.h' file not found
#import <RESideMenu.h>
        ^
<unknown>:0: error: failed to import bridging header '/path_of_my_project/Swift-Bridging-Header.h'

Upvotes: 18

Views: 18772

Answers (3)

jamesthakid
jamesthakid

Reputation: 1265

I had the same issue. I changed all my imports from #import "RESideMenu.h" to #import <RESideMenu/RESideMenu.h> for example.

Upvotes: 1

DasDany
DasDany

Reputation: 185

I'm actually on the same problem. You could try this: http://www.innerexception.com/2015/05/cocoapods-useframeworks-means-bridging.html

When using use_frameworks! in CocoaPods all of your pods will be used as frameworks, not only the swift pods. So you don't need an bridging header for this. Just import your pods into all swift files you need. In your example you have to write: import RESideMenu

Upvotes: 16

mosn
mosn

Reputation: 311

Try removing isam/ from the Objective-C Bridging Header and have only Swift-Bridging-Header.h

Coming from personal experience, CocoaPods still have some issues when combining swift and Objective C frameworks. You can use Alamofire which is almost equivalent of AFNetworking for swift.

Hope this helps.

Edit : Also why use Objectice-C Parse in swift when you can directly use swift libraries.

Upvotes: 2

Related Questions