问题
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'
回答1:
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)
回答2:
Answer for future reference: "Clean" your product
来源:https://stackoverflow.com/questions/35642866/xcode-7-2-failed-to-import-bridging-header