Search code examples
objective-cswiftwatchkitapple-watchbridging-header

PojectName-Swift.h Not found while using Both Swift and ObjC codebase


I had a perfectly working ObjC project integrated with Apple WatchKit App with Multiple Targets. Only one of the Targets is linked with the WatchKit App.

I am moving my classes to swift and hence there are ModuleName-Swift.h files being used in my code.

Followed steps given in ModuleName-Swift.h file not found in xcode8 and I have ensured to add the “$(PROJECT_NAME)-Swift.h” under Projects > Build Settings > Objective-C Generated Interface header name.

enter image description here

But when I go to the build settings - it shows as Objective-C generated interface header name for the project target and Swift_ObjC_Interface_header_name for WatchKitApp Target

Error thrown by compiler : ProjectName-Swift.h file Not found

Is this causing the error? Not sure what I am Missing.

This is how I've linked the -swift.h files in Other targets

enter image description here

enter image description here

enter image description here


Solution

  • The issue was:

    • There were Unit test cases that were failing, disrupting further Compiling of the Project

    Quick Fix:

    • The ObjectiveC Classes had Unit test cases associated with it.
    • Some of the Unit tests were failing due to changes to the main code base.
    • I had to uncheck the the following under Edit Schemes > Build so that they don't Build while running the WatchKit App.

    enter image description here

    I agree I will have to update the test cases to work with the Updated app, But the issue of Watch App not working is Fixed! :)