If you have recently upgraded your Xcode to 7.1 version, you will start getting cordova/CDVViewController.h file not founderror. You would be surprised that earlier build was working perfectly fine with Xcode 6.4 and Xcode 7.0

Error

Error - cordova/CDVViewController.h file not found

To fix this error follow these steps:

  • In Xcode select the project and go to Build Settings of the project and the Search for Header Search Path
    It will show you below shown screen.
    enter image description here

    Double click on the Multiple values row and it will show you a list pop-up now add a new row to this list and add content

    $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

Then archive/build the app and you will see everything works fine.

  • If you want to add this content from command line instead of directly adding it using XCODE IDE, then use command:

    xcodebuild HEADER_SEARCH_PATHS="\$(TARGET_BUILD_DIR)/usr/local/lib/include \$(OBJROOT)/UninstalledProducts/include \$(BUILT_PRODUCTS_DIR) \$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"

NOTE

Reason behind this issue is, release of new platforms like tvOS, there is an extra folder has been created to archive intermediates, namely a folder with the name of the os. earlier we had "$(OBJROOT)/UninstalledProducts/include" and now we should have "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include"
To make xcode 7.1 work we should have these both paths added to `HEADER_SEARCH_PATHS

`