Objective-C - Swift bridge causes: "String" file not found error

119 Views Asked by At

I am noob to macOS, and never had done anything on it, now I am forced to work on it for my thesis (I have 10 more days to finish it) I have to connect a foreign, CocoaPods based objc project's test function with my python codes, and Swift seemed to be the easiest option for calling both objc and python (of course, I have tried several other methods too, which I will list below). The Python way worked, but after importing the necessary objc header to the objc-swift bridge I received the following error:

failed to emit precompiled header <bridging header path> <file path that includes string> 'string' file not found

It is important, that it works finely without: importing to the bridging header something that is imports a C++ header!

Here is what I've tried to do before:

  • I have checked that all relevant file's extensions are changed from '.m' to '.mm'
  • I have added libcc.tbd under Build Phases/Link Binary With Libraries
  • Changed Build Settings/User-Defined/CLANG_CXX_LIBRARY to libcc.
  • Tried out all possibilities under Build settings/Apple Clang - Language - C++/C++ Language Dialect.

I am sure, that I have tried out even more obscure possibilities, but I have been working on this for 2 weeks and may have forgot some of them.

I have also tried different approaches to solve the python - ObjectiveC interaction:

  1. Calling terminal from ObjectiveC with NSTask: 'launchPath' is unavailable: not available on iOS AND 'launch' is unavailable: not available on iOS
  2. Calling objectiveC test function from terminal with xcodebuild: The Test Target is dependent on a Host Application Target, and the Host Application's Library Search Path params point to a .app file. It builds in Xcode, but does not in xcodebuild (I don't know the science behind it).
0

There are 0 best solutions below