Rajeev
Rajeev

Reputation: 4992

adding 'use_frameworks!' in podfile is breaking app

My iOS app contains both objective-C and Swift code. Now i have added use_frameworks! at the top of pod file to use some swift library. Unfortunately it started giving compilation errors.

My pod version : 0.39.0

It started complaining about imports in bridge.h file

Pod file contains objective-C libraries. Now i want to add swift libraries.

How can i fix this issue. Let me know if needs more details

use_frameworks!
platform :ios, '9.0'

xcodeproj 'Test.xcodeproj'

def devDependecies

    pod 'SocketRocket'
    pod 'CocoaLumberjack'
    pod 'MRProgress'
    pod 'GRMustache', '~> 7.3.0' 
    pod 'Realm', '=0.96.2'
    pod 'ADALiOS'
    pod 'Office365/Outlook'
    pod 'Office365/Discovery'
    pod 'AFNetworking'
    #https://github.com/youtube/youtube-ios-player-helper/issues/160
    pod 'youtube-ios-player-helper', :git=>'https://github.com/youtube/youtube-ios-player-helper', :commit=>'head'
    pod 'iOSCalendarEventParser', '=0.0.4'
    pod 'OneDriveSDK'

end


target 'Test' do
    devDependecies
end

Sample error in bridge.h file : enter image description here

But this file exists under pod directory. enter image description here

Upvotes: 0

Views: 3031

Answers (2)

Alex Zanfir
Alex Zanfir

Reputation: 573

At this moment Xcode does not allow that. use_frameworks works only with swift pods or libraries. If you add an objective C library you need to use the bridging header, therefore you need to remove the use_frameworks instruction in order to make it work. The only work around I found is to only import through pods the objective C libraries and the swift libraries you can add them manually. You can copy the classes names and content and use them as if you would have created them.

Upvotes: 0

Nicolas Rosa
Nicolas Rosa

Reputation: 121

'youtube-ios-player-helper' can compile as a framework. So remove it from the bridge header and just add an import line in your Swift classes

import youtube-ios-player-helper

Do the same for all pods that can compile as a framework

Upvotes: 1

Related Questions