Cordova ios 错误构建 Images.xcassets [英] Cordova ios error building Images.xcassets

查看:33
本文介绍了Cordova ios 错误构建 Images.xcassets的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了很多时间试图解决这个问题,但无济于事.

I've spent a lot of time trying to work this out to no avail.

我更新了cordova,自从el capian 我的mac 现在有NPM 和cordova 的问题.

I udpated cordova and since el capitan my mac now has issues with NPM and cordova.

我已经安装了它,但我现在必须对cordova使用sudo.

I got it to install but I have to use sudo for cordova now.

尝试了以下内容:

sudo cordova platform remove ios
sudo cordova platform add ios
sudo cordova build ios

这给了我以下输出:

** BUILD FAILED **


The following build commands failed:
    CompileAssetCatalog build/emulator/<AppName>.app <AppName>/Images.xcassets
(1 failure)
ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/cordova/build-debug.xcconfig,-project,<AppName>.xcodeproj,ARCHS=i386,-target,<AppName>,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/sharedpch
You may not have the required environment or OS to build this project
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/cordova/build-debug.xcconfig,-project,<AppName>.xcodeproj,ARCHS=i386,-target,<AppName>,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/MacUserName/Desktop/<AppName>/<AppName>/platforms/ios/build/sharedpch

科尔多瓦版本

sudo cordova -v
6.0.0

更新:我现在运行的是 6.1.1,还是同样的问题

Update: I'm now running 6.1.1, still the same issue

Cordova iOS 平台版本

Cordova iOS platform version

sudo cordova platform ios -v
6.1.1

Mac 版本:10.11.3
XCode 版本:7.2.1

Mac Version: 10.11.3
XCode Version:7.2.1

推荐答案

我建议使用 cordova-icon 和 cordova-splash npm 包.这是因为您可以在根目录中放置两个图像,然后命令将为您解决其余的问题.它们是由cordova 编写的,您可以使用以下方法进行安装:

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

然后在项目根目录中放置一个 1024x1024 版本的徽标作为icon.png".并且:

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

初始屏幕图像应为 2208x2208 像素,中心正方形为大约 1200x1200 像素.图像可能会围绕中心正方形进行裁剪."

"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

只需将与该描述匹配的图像作为splash.png"放在项目根目录中

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

删除 config.xml 中指定要用于 ios 的图像的任何行,cordova-icon/splash 会自动将它们以正确的名称放在正确的位置,以便 xcode 识别它们.

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

但是你可能没有构建配置,或者需要额外的参数.如果构建失败(即使您认为它会失败,也要确保运行该命令 - 它会进行设置)只需在 xcode 中的平台/ios 中打开生成的工作区,清理项目,然后构建.那应该可行.

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.

这篇关于Cordova ios 错误构建 Images.xcassets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆