I added a bridge header to my app the other day because I was trying to add Objective-C files to my Swift project. I was having trouble getting the connection to work(and I also did not know how to implement the Objective-C files), so I decided I wanted to start over again. I deleted the Objective-C files and the Bridge-Header file and now I am getting an error saying:
<unknown>:0: error: bridging header '/Users/CalebKleveter/Documents/Development/iOS/personal/swift/Projects/Dicey/Dicey/Dicey-Bridging-Header.h' does not exist
How do I remove a bridge header without getting errors?
Asked Answered
This works, and in case anyone ends up with a lot of new errors with NSObject after removing this, check to make sure that you have 'import foundation' in your classes that inherit from NSObject. The bridging header negated the need for those import statements beforehand. –
Spirochete
I had to remove this from the Target Build Settings not the Project, but it's thanks to your answer I found this. :-) –
Ecclesiastic
Did not solve all my problems. When I run my app and using a UICollectionView I get 'Unable to simultaneously satisfy constraints...' –
Adlar
@Adlar it's some kind of Auto Layout problem, not related to bridging header. This might help you: #25630815 –
Cooee
I think you are right. Just that I got it after I removed the bridging header (or maybe I just noticed it afterwards). Anyway, I fixed it. –
Adlar
Xcode 11.4.1 has a file UIView+image.swift that throws a Build error in an extension to UIView when I removed the objective-c bridging header path as described. I had to edit the file and add "import UIKit" even though "import Foundation" was already there. This seems like an Apple Swift problem. –
Gribble
Since removing the bridging header or even just leaving it without any content often causes build errors, the quick workaround I've found is leaving the header with nothing but the following two imports:
#ifndef BridgeHeader_h
#define BridgeHeader_h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
Deleting the lines containing SWIFT_OBJC_BRIDGING_HEADER
in MyProjectName.xcodeproj/project.pbxproj
did the trick for me.
I could not find the Build Settings in my Xcode project as other answers mentioned (maybe because my project is for MacOS, not iOS?).
© 2022 - 2024 — McMap. All rights reserved.