I\'ve spent a lot of time trying to work this out to no avail.
I udpated cordova and since el capitan my mac now has issues with NPM and cordova.
I got it to
I had the same problem as the OP and whilst the accepted answer was correct and helpful there is now an updated (and maintained) resource generator on npm called cordova-res, which replaces cordova-icon and cordova-splash. Also, the required splash screen dimensions have increased. All the details you need are on the npmjs cordova-res page, from which I have taken the following info.
Install with:
npm install -g cordova-res
You'll need your icon.png and splash.png (the website says JPEG or PNG) images ready. These need to have the following dimensions:
icon.(png|jpg) must be at least 1024 × 1024px
splash.(png|jpg) must be at least 2732 × 2732px (note the increased size)
Just a little side note about the splash screen. Your image needs to be in the centre of the splash screen so that different rectangular device sized images are generated without cropping your splash screen image. As the accepted answer says, the size of this centre image needs to be about 1200 x 1200px.
Place these images in a resources folder in your project:
resources/
├── icon.png
└── splash.png
Before you generate the resources it might be worth removing and adding your ios platform (and others if you're building them too) to start with a clean platform folder. I don't know for sure if this is necessary.
cordova platform remove ios
cordova platform add ios
Run the following to generate the resources:
$ cordova-res
Then you can build your platform:
cordova build ios
Now all should be OK and hopefully resolved your xcassets error, as it did for me.
I managed to fix this issue by:
config.xml
file;splash.png
and/or icon.png
files in the www/resources
folder of your cordova project; then,ionic cordova resources --icon
or ionic cordova resources --splash
commandthis will create all the correct splash/icon files for you and add them to the config.xml
file. That warning then goes away.
Hope this works!
I got this error when I was using cordova-icon
but my icon.png
image was not square.
Changing the icon.png
to a square image and re-doing cordova-icon
meant that cordova build ios
now works for me.
For a solo icon.png file, the image must be 1024x1024 to get working with a solo <icon src="icon.png"/>
in the config.xml.
I have to this with cordova-cli 6.5.0, cordova-ios 4.5.1 and xcodebuild 9.0.