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
4 Answers
-
7This 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.– bitsandApr 24, 2016 at 14:24
-
12I had to remove this from the Target Build Settings not the Project, but it's thanks to your answer I found this. :-)– lukkeaApr 29, 2016 at 11:44
-
Did not solve all my problems. When I run my app and using a UICollectionView I get 'Unable to simultaneously satisfy constraints...'– ZviAug 29, 2016 at 12:50
-
@Zvi it's some kind of Auto Layout problem, not related to bridging header. This might help you: stackoverflow.com/questions/25630315/… Aug 29, 2016 at 15:26
-
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.– ZviAug 29, 2016 at 15:30
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?).