0

Im trying to link an external Objective-C framework, "frameworkSDK", to my swift project. However I seem to be getting this error :

<unknown>:0: error: failed to import bridging header

I've looked at loads of solutions to my problem but non of them seem to work. Here's what I've done so far :

  • I've created a "bridingfile.h" at the root of the project and imported "frameworkSDK.frameworkSDK.h" to the file.

  • I've made sure Objective-C Bridging Header path was correct under Swift Compiler - Code Generation.

  • I've changed my framework search paths to the where the "frameworkSDK" is located - Code Generation.

  • Added the path to "bridgingfile.h" to Header Search Paths - Code Generation.

  • I've tried to instead create the bridgingfile 1 directory in from the root folder, and then update accordingly.

Any help would be greatly appreciated! :)

Speedpoint
  • 83
  • 1
  • 4

1 Answers1

0

If you are importing an external Objective-C framework, i.e. one stored in, say, frameworkSDK.framework directory structure (bundle), you should not have to worry about a bridging header. Instead do the following:

  • Under Build Settings set Framework Search Paths to the parent directory of the frameworkSDK.framework directory.
  • Also under Build Settings set Runpath Search Paths to $(FRAMEWORK_SEARCH_PATHS) @executable_path/../Frameworks.
  • In a Swift file where you want to use the Objective-C framework do import frameworkSDK.
Anatoli P
  • 4,791
  • 1
  • 18
  • 22
  • I've tried what you suggested, but then I get an error : "No such module frameworkSDK". I've looked at solutions on stack to this problem but none of these seem to work : http://stackoverflow.com/questions/29500227/xcode-no-such-module-error-but-the-framework-is-there – Speedpoint Sep 02 '16 at 08:25