Xcode 7.2: In “Archive”: Getting the issue: “Cordova/CDVViewController.h’ file not found ”. While there is no such issues in building the app

Solution 1:

This issues seems to appear in Xcode 7.2 due to search path/include.

Solve this in following way:

  1. Select your [projectName] in Xcode TARGETS.

  2. Go to Build Settings tab.

  3. Make sure that the filter is set to "All" and not "Basic".

  4. Search "Header Search Paths"

  5. Double click and add this path to both "Debug" and "Release": $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

  6. Now clean the Project and restart Xcode.

  7. Able to make the Build and Archive.

  8. That's All.

Solution 2:

After trying every solution with no success I ran:

cordova platform update ios

This fixed it for me. (XCODE 7.3.1, Cordova 6.3.0)

Reference: Cordova app failing to Archive with Xcode 7.1 (Cordova/CDVViewController.h file not found)

Solution 3:

If adding this line:

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

to the headers-search-path (as described in 'im3r3k' answer) didn't fixed this issue, also set this:

Build Settings -> Architectures -> Build Active Architecture Only -> YES

Solution 4:

You should update your project's Cordova iOS version to 3.9.2 (latest version of 3 as of 3/11/16). I got this same error when using 3.8.0 and it was fixed in 3.9.

Alternatively, you could upgrade to Cordova iOS v4.1.0 (bleeding edge as of 3/11/16) but be aware you lose support for iOS 6 and 7, and cordova-plugin-screen-orientation isn't updated to use 4 yet so you have to lock your app in portrait or landscape.

EDIT:

Without upgrading you can fix this manually in XCode. go to

Build Settings -> Header Search Paths : Change:

$(OBJROOT)/UninstalledProducts/include

to:

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

(related issue on apache.org)

Solution 5:

This fixed it for me:

  • Open your project in Xcode
  • Go to Preference -> Locations -> Advanced
  • Choose "Unique" as the option for Build Location
  • Product -> Clean
  • Product -> Build

Taken from https://forum.ionicframework.com/t/cordova-cdvviewcontroller-h-file-not-found-in-xcode-7-1-beta/32232/40