27
votes

I have a problem when I build the ios platform with cordova. I have all the certificates for the app and device, but when I try to run in my ios device, doing ionic run ios, the console return this error:

Error: Source path does not exist: resources/ios/icon/[email protected]

This path is written in config.xml file.

I tried to run it in xCode but the problem there was:

Cordova/CDVViewController.h not found

I read a lot of possible solutions but any works for me.

My xCode version is 7.3.1, the cordova version is 6.3.0 and the cordova ios version is 4.2.0.

18
Can you show some code examples of your config.xml and index.html? And also the exact error your getting on the command line?johnborges
Regarding the second problem, please refer to this answerBernardo Dal Corno

18 Answers

60
votes

If you are missing the icon you can run the command

ionic resources --icon

This will generate all the icons with the pixels needed to run on any device.

To simulate on the device you first need to

ionic build ios

and then

ionic simulate ios

It is also a good practice to have xcode up to date.

If you are still getting the error you can paste this line

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

on Build Settings > Header Search Paths. Do not remove the similar line, just add it at the end.

39
votes

Update - 03-08-2017

> ionic cordova resources

Old CLI command:

I had the same error, and after re-running ionic resources it went away.

The problem was that I had Windows-style slashes (backslashes) in the path of the icon, i.e. the error I had was this:

Error: Source path does not exist: resources\ios\icon\icon-40.png

So, converting backslashes into slashes resolved it for me.

Update: And regarding your second error, it helped me to reset the state:

ionic state reset

Make sure you have ios listed under cordovaPlatforms in your package.json before running this command. Then ionic automatically re-downloads your plugins afresh and is ready to build.

Hope that helps. Take care!

19
votes

I've had same error only with other image:

Source path does not exist: resources/ios/icon/[email protected]

This happened after upgrading to Cordova 6.3.0 and I've solved it downgrading Cordova.

Quickfix for now:

npm uninstall -g cordova
npm install -g [email protected]
11
votes

Just use: Remove platform

cordova platform remove ios

And add ios platform with old one

cordova platform add [email protected] --save

It worked for me..

@4.0.0 will select previous version automatically

3
votes

I have try some times, finally success.

  1. use ionic resources --icon , maybe met the new problem

"Unable to generate images due to an error Failed to upload source image: Error: read ECONNRESET"

don't worry , try it later

  1. use ionic platform remove ios when execute successfully use ionic platform add ios

DON'T USEionic state reset

3
votes

Try to replace the "\" with "/" (backslash and slash) in the config.xml.

If you create the project on a Windows system and move to macOS for iOS compilation, it still has the Windows URI format.

1
votes

I've found this issue in several occasions and some of the provided answers worked quite well till today, when no one worked.

My environment: MacOS high Sierra 10.13, ionic cli 3.18.0 and cordova 7.1.0.

My problem was that if I run ionic cordova prepare it fails saying that I need to add a platform and if a I add a platform with ionic cordova platform add ios it fails with the error specified in the answer:

Error: Source path does not exist: resources/ios/icon/[email protected]

What solved my issue was manually creating the platforms folder: mkdir platforms. After creating this folder, adding a platform worked as usual.

I hope it could help someone out there.

1
votes

I got similar issue with cordova-ios@~4.5.1

ionic cordova build ios

> cordova build ios
Error: Source path does not exist: resources\android\icon\drawable-xhdpi-icon.png

[ERROR] An error occurred while running cordova build ios (exit code 1).

ionic cordova platform add ios

> cordova platform add ios --save
Using cordova-fetch for cordova-ios@~4.5.1

Adding ios project...

Creating Cordova project for the iOS platform:

Path: platforms/ios
Package: -
Name: -
iOS project created with [email protected]

Error: Source path does not exist: resources\android\icon\drawable-xhdpi-icon.png

I remove ios platform

ionic cordova platform remove ios

And add ios platform with old one

ionic cordova platform add [email protected]

This worked for me, waiting for an Cordova update :)

1
votes

it's a cat and mouse problem,

  1. the icon resources aren't built because the platform isn't added and
  2. platform can't be added because the icon resource isn't there

ionic/cordova is pretty unstable and a nightmare to work with in CI pipeline.

this kept crashing out CI pipeline. just keep removing and adding the android/ios platform and build the resources using ionic cordova resources --force

0
votes

Running these commands solved it for me:

ionic platform rm ios

ionic resources

ionic platform add ios

0
votes
0
votes

It says that the resources directory only contained empty folders. Downloading this repo (https://github.com/ionic-team/ionic2-app-base/tree/master/resources) and replace the resources directory

Run again the "ionic cordova resources".

0
votes

You just need to update the cordova to fix this error: to update the cordova run below command

$sudo npm install -g [email protected]

once you update the cordova type below command to remove the platform

$sudo ionic cordova platform rm ios --save

And then add platform again using below command

$sudo ionic cordova platform add ios --save

I hope this will help you.

0
votes

I ran into the same problem:

Error: Source path does not exist: resources/ios/icon/[email protected]

Looks like the relative path is in reference to the config.xml. If the resources folder exists inside of 'www', then you may need to update the relative path.

I was able to resolve this by updating the relative path to "www/resources/...".

0
votes

It's likely that your resources haven't been run.

Run:

npm i -g cordova-ionic platform rm ios
ionic platform rm ios // You want to do this just so when you recreate you have necessary resouces
ionic cordova resources
ionic cordova build --release <ios/android>

There should be more answers with this solution, since ionic is a project based on npm and this command will install the necessary libraries.

0
votes

I used the no brain way, but it works. I added the ressources temporarily with the name they ask for.

Like I copy and past an image icon-20 copy.png then rename it into my needed ressources like [email protected]

0
votes

use

ionic cordova resources --icon

if permission required use sudo

sudo ionic cordova resources --icon

it will Generated 28 resources for iOS and Generated 6 resources for Android.

-1
votes

make sure you add: xmlns:cdv="http://cordova.apache.org/ns/1.0

to the widget section(on the very top) of your config.xml

This will add all necessary Cordova components.