“file not found” in Bridging Header when importing Objective-C frameworks into Swift project by CocoaPod
My solution is :
Do not import the ObjC framework in bridging header file, just import the framework in the files in which the framework is needed. just like:
CocoaPods Bridging Header file not found
When using the
use_frameworks! instruction in Cocoapods, the bridging header is not required for importing Objective-C pods in Swift.
Simply set your desired pods into your podfile:
#Uncomment this line to define a global platform for your project
platform :ios, '9.0'
#Uncomment this line if you're using Swift
target 'YourProject' do
#This stuff is to set the SWIFT_VERSION
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
pod install. Run
pod update (should not be necessary, but for some reason I'm getting updates almost every time, even after clean install). Close Xcode and reopen using the white
Getting file not found in Bridging Header when importing Objective-C frameworks into Swift project
Found a solution:
- The "Objective-C Bridging Header" setting (aka
SWIFT_OBJC_BRIDGING_HEADER) must be set at the Target level, and NOT the Project level. Be sure to delete the setting value at the Project level.
(to me, it seems like an Xcode bug, since I don't know why it fixes it).
Swift Bridging Header File Not Found
I suspect the spaces are causing problems.
And the import line in the bridging header should be something like this:
I assume you are trying to run the Example from here: https://github.com/m1entus/MZFormSheetPresentationController
It seems like that bridging header file was accidentally removed (or was never there).
You can create your bridging header by following the instructions here: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
with the following contents:
Can you change this line:
#import <MZFormSheetPresentationController/MZFormSheetPresentationController Swift Example-Bridging-Header.h>
Bridging Header File can't find an imported Objective-C project
OK. I figured it out. I just didn't use the *.xcworkspace project after installing pods... After opening my project with this file, everything works well, as expected.
Thanks for your help, especially @kaizoku for suggesting me to use this file.
Access Firebase Variable Outside Closure
Cannot Assign Property in Method of Struct
How to Encode a String to Base64 in Swift
How to Create a Segue That Can Be Called from a Button That Is Created Programmatically
Can Swift Convert a Class/Struct Data into Dictionary
How to Create Generic Protocols in Swift
Extend Array Types Using Where Clause in Swift
Unwrapping Multiple Optionals in If Statement
Getting Keyboard Size from Userinfo in Swift
How to Compare Two Dictionaries in Swift
How to Create Array of Unique Object List in Swift
Failing Cast in Swift from Any? to Protocol
How to Find String B Missing Characters Based on String a and Add Them to String B
How to Use Instance Method as Callback For Function Which Takes Only Func or Literal Closure
Any Reason Not Use Use a Singleton "Variable" in Swift