【问题标题】:Cordova build uses wrong res pathCordova 构建使用错误的 res 路径
【发布时间】:2016-03-24 10:18:21
【问题描述】:

我正在使用 cordova build 为我的应用程序生成一个 iOS 项目。在我的 config.xml 中,我指定了以下资源:

    <icon height="29" src="res/icons/ios/icon-small.png" width="29" />
    <icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" />
    <icon height="40" src="res/icons/ios/icon-40.png" width="40" />
    <icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" />
    <icon height="50" src="res/icons/ios/icon-50.png" width="50" />
    <icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" />
    <icon height="57" src="res/icons/ios/icon.png" width="57" />
    <icon height="114" src="res/icons/ios/icon-2x.png" width="114" />
    <icon height="60" src="res/icons/ios/icon-60.png" width="60" />
    <icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" />
    <icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" />
    <icon height="72" src="res/icons/ios/icon-72.png" width="72" />
    <icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" />
    <icon height="76" src="res/icons/ios/icon-76.png" width="76" />
    <icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" />
    <splash height="480" src="res/screens/ios/screen-iphone-portrait.png" width="320" />
    <splash height="960" src="res/screens/ios/screen-iphone-portrait-2x.png" width="640" />
    <splash height="1136" src="res/screens/ios/screen-iphone-portrait-568h-2x.png" width="640" />
    <splash height="1334" src="res/screens/ios/screen-iphone-portrait-667h.png" width="750" />
    <splash height="2208" src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242" />
    <splash height="1024" src="res/screens/ios/screen-ipad-portrait.png" width="768" />
    <splash height="2048" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" />

(./res 和 res 也试过了)

当我运行 cordova buid ios 时,每个指定的文件都会出错:

cp: no such file or directory: /path/to/project/config.xml/res/icons/ios/icon-60.png

看起来 config.xml 被用作目录。 (正确的路径是没有 config.xml)。如何解决这个问题?

【问题讨论】:

  • 您使用的是什么版本的cordova ios? cordova ios 4.0.0 似乎也有类似的问题,它在 ios 4.0.1 中关闭了更多信息在下面的链接中 - issues.apache.org/jira/browse/CB-10172
  • 确实,它在更新到 cordova-ios 4.1 后已修复(奇怪,因为我之前尝试过)。图像现在可以使用,但现在找不到 index.html :-(

标签: ios cordova path


【解决方案1】:

对于有需要的人:

经过数小时的调试,我发现 cordova-ios 错误地实现了各种路径。自己修复了这个问题后,我发现这已经在 this commit 的较新版本中完成了。

解决方案是删除 cordova-ios cordova platform remove ios 并使用 cordova platform add ios@latest 重新添加。

【讨论】:

    猜你喜欢
    • 2013-11-17
    • 2011-12-27
    • 1970-01-01
    • 1970-01-01
    • 2019-02-16
    • 2012-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多