Cordova ios error building Images.xcassets

前端 未结 10 1788
时光取名叫无心
时光取名叫无心 2020-12-05 17:33

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

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 18:11

    I would recommend using the cordova-icon and cordova-splash npm packages. This is because you can just put two images in your root, then the commands will work out the rest for you. They are written by cordova, and you can install using:

    npm install -g cordova-icon
    npm install -g cordova-splash
    

    Then just put a 1024x1024 version of your logo as "icon.png" in the project root. And:

    "The splash screen image should be 2208x2208 px with a center square of about 1200x1200 px. The image may be cropped around the center square."

    https://www.npmjs.com/package/cordova-splash

    Just put an image matching that description in the project root as "splash.png"

    Remove any lines in config.xml that specify the images to use for ios, cordova-icon/splash will automatically put them in the correct place with the right names so that xcode will recognize them.

    Once you've got that setup, just execute these commands:

    cordova platform remove ios
    cordova platform add ios
    cordova-icon
    cordova-splash
    

    Then run your build command. For me it is:

    cordova build ios --build-config
    

    But you may not have a build config, or need additional params. If the build fails (make sure you run the command even if you think it will fail - it will set things up) just open the generated workspace in platforms/ios in xcode, clean the project, and build. That should work.

提交回复
热议问题