Xcode 7.2 Failed to import bridging header

2019-08-30 22:26发布

I have a new configuration(Duplicate of debug) which is showing the error "Failed to import bridging header". But the debug configuration is compiling and running without fail. Following are the details

  • Xcode 7.2
  • iOS SDK 9.2
  • Cordova pluggins in Objective C
  • Native application code is swift 2.x
  • One target
  • Three configurations debug,test(duplicate of debug) and release.

While building the project in Debug/Release configuration no errors and running the app in simulator without any issue.

When I build configurations TestDebug(duplicate of Debug) or TestRelease(duplicate of Release) there are two errors

/Users/ ..../MainViewController.h:11:9: 'Cordova/CDVViewController.h' file not found

Failed to import bridging header '/Users/......./Example4-Bridging-Header.h'

2条回答
Viruses.
2楼-- · 2019-08-30 22:52

You need to add these Configurations (TestDebug, TestRelease) to the Cordova project as well Otherwise your main project will look in the folders for TestRelease and TestRelease but won't find the Cordova build results there By Default Cordova puts build result in Debug-iphoneos and Release-iphoneos

I had a similar issue when I added a custom Distribution to my project. For me it worked when building, but failed at archiving. Adding the custom Distribution to Cordova helped

After a clean and build you should see the Cordova lib and include in TestDebug-iphoneos or TestRelease-iphoneos and not in Release-iphoneos or Debug-iphoneos( where I guess it adds it now for you)

查看更多
Luminary・发光体
3楼-- · 2019-08-30 23:14

Answer for future reference: "Clean" your product

查看更多
登录 后发表回答