简体   繁体   中英

Error building ios with cordova

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/icon-40@3x.png

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.

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.

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, ie 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!

I've had same error only with other image:

Source path does not exist: resources/ios/icon/icon-40@2x.png

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 cordova@6.2.0

Just use: Remove platform

cordova platform remove ios

And add ios platform with old one

cordova platform add ios@4.0.0 --save

It worked for me..

@4.0.0 will select previous version automatically

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 USE ionic state reset

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.

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/icon-40@3x.png

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.

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 cordova-ios@4.5.4

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 ios@4.0.0

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

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

Running these commands solved it for me:

ionic platform rm ios

ionic resources

ionic platform add ios

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".

我不得不从任何其他项目存储库手动复制文件,例如https://github.com/sphilee/eTAS_GPS/tree/master/resources/ios

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

$sudo npm install -g cordova@6.2.0

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.

I ran into the same problem:

Error: Source path does not exist: resources/ios/icon/icon-40@3x.png

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/...".

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.

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 icon-small@2x.png

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM