Swift – Getting “file not found” in Bridging Header when importing Objective-C frameworks into Swift project


I have a Swift project for which I'm trying to import ObjC-based frameworks. The framework is located in a directory under the project's path and is referenced by the project in Xcode. It's also added to the "Link Binary with Libraries" in the project's 'Build Phases' page.

However, for some reason, I can't seem to include the framework in the Bridging-Header file. I get the following error:

BridgingHeader.h:5:9: error: 'Parse/Parse.h' file not found
#import <Parse/Parse.h>
<unknown>:0: error: failed to import bridging header 'BridgingHeader.h'

Things I've checked:

  1. The "Install Objective-C Compatibility Header" is set to "YES".
  2. The Header Search Paths includes the path to the frameworks.

I'm sure I'm missing something, so if anyone has any clues, that would be great.

Best Answer

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).