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>
“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:
Xcode does not find Swift bridging header file in some files
I finally came up with the solution on my own : the project.pbxproj file was kind of corrupted after some git merge I guess. Some files of the project were referenced twice in that file, so I deleted the ones I thought being bad (maybe randomly chosen is closer from the truth).
Now it's working like a charm.
In fact this had no effect on the project until I tried to migrate files to Swift !
It would be a great idea to have a tool or function in XCode to reset this project.pbxproj file to the current things we have.
Xcode can't find Bridging header when loading Framework
Frameworks with mixed Swift and Objective-C code do not need (and should not have) a bridging header.
First make sure that your framework's build settings includes "Defines Module: Yes".
Then, your framework should already have an umbrella header, this is the header with the same name as your framework with stuff like this in it
//! Project version number for MyFramework.
FOUNDATION_EXPORT double MyFrameworkVersionNumber;
//! Project version string for MyFramework.
FOUNDATION_EXPORT const unsigned char MyFrameworkVersionString;
Any Objective-C stuff that you want to be visible to Swift needs a header with public membership which is imported into that umbrella header like this
#import <MyFramework/MyHeaderName.h>. Note that you need to apply this rule recursively: if you import an Objective-C header in the umbrella header, anything it imports also needs to be public and in the umbrella header.
This can be a little tricky if some of your Objective-C headers have unnecessary imports, or import stuff that you don't want to be public in your framework. You may need to restructure you code a bit so that you have a clear separation between public and private headers.
If you do that, all of that public Objective-C code should be automatically usable in the framework's Swift code, without any bridging header.
Official docs here: https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift
After importing Objective C Framework into my Swift project, my project does not recognise my header file in my Bridging file
I would review the setup for AWS at their website. They even have a section that details using with Swift iOS9.
Among other things, if you are using the Frameworks manual integration, verify that step 4 is complete.
Under the Build Phases tab in your Target, click the + button on the
top left and then select New Run Script Phase. Then setup the build
phase as follows. Make sure this phase is below the Embed Frameworks
Show environment variables in build log: Checked Run script only when
installing: Not checked
Input Files: Empty Output Files: Empty
You might want to install and use Carthage to make this easier. Head over to the Homebrew website then after installing homebrew you'd run brew install carthage from the command line. After that go back to the link above and follow the Carthage instructions.
Secondly, I would take another walkthrough of the Apple Documentation on Working with the bridging header files to see if any of the edge cases apply and just as a sanity check.
Third, if that doesn't work, I'd just try creating an empty Swift project and walk through the steps again using one of the techniques above. There might be something wrong with one or more settings in your project files or the file itself might be corrupt.
BTW - The product bundle identifier should probably be following the convention of com.yourdomain.YourProductName.
What Does "Fatal Error: Unexpectedly Found Nil While Unwrapping an Optional Value" Mean
Is Key-Value Observation (Kvo) Available in Swift
Swiftui Ios14 - Navigationview + List - Won't Fill Space
Formatting Input For Currency With Nsnumberformatter in Swift
Deinit Method Is Never Called - Swift Playground
How to Set Associated Objects in Swift
Swift - How to Convert String to Double
Swiftui Hstack With Wrap and Dynamic Height
Do Swift-Based Applications Work on Os X 10.9/Ios 7 and Lower
How to Print the Type or Class of a Variable in Swift
Sending Json Array Via Alamofire
Uitableview With More Than One Custom Cells With Swift
Convert String to Date in Swift
Remove or Edit User Location Blue Pulsing Circle