ios PhoneGap 应用程序:“错误:未找到位于 `www/index.html` 的起始页”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6026285/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:57:04  来源:igfitidea点击:

PhoneGap application: "ERROR: Start Page at `www/index.html` was not found"

ioscordova

提问by sujay

I have created a Phone Gap based application on iPhone. After the first run, I have dragged my wwwfolder, containing index.htmlinto the project, but still I am getting the following error in the simulator:

我在 iPhone 上创建了一个基于 Phone Gap 的应用程序。第一次运行后,我将我的www文件夹拖到index.html项目中,但仍然在模拟器中收到以下错误:

ERROR: Start Page at www/index.htmlwas not found.

错误:www/index.html未找到起始页。

Do I have to mention the name of index.htmlin a plist file or anywhere else? How can I resolve this; can any one help me?

我是否必须index.html在 plist 文件或其他任何地方提及的名称?我该如何解决这个问题;谁能帮我?

回答by Tim S

It's an incompatibility between PhoneGap and XCode 4. To resolve:

这是 PhoneGap 和 XCode 4 之间的不兼容。要解决:

  • right click on your project and choose "Add files to [project name]...";
  • choose the wwwfolder from your curent project's folder (it's included in there, but not added as a reference);
  • when you select the folder, make sure you choose "Copy items into destination group's folder"as well as "Create folder references for any added folders".
  • 右键单击您的项目并选择“将文件添加到 [项目名称]...”;
  • www从当前项目的文件夹中选择文件夹(它包含在那里,但未添加为参考);
  • 选择文件夹时,请确保选择“将项目复制到目标组的文件夹”以及“为任何添加的文件夹创建文件夹引用”

Note:if you choose "Create groups for any added folders", the app will still fail at runtime.

注意:如果您选择“为任何添加的文件夹创建组”,应用程序在运行时仍会失败。

回答by akiraspeirs

For those who are as silly as me... I had forgotten to run cordova build.

对于那些和我一样愚蠢的人......我忘记了跑步cordova build

回答by Kaushik Makwana

Quit XCodeand apply below command in terminal, its work for me

退出XCode并在终端中应用以下命令,它对我有用

ionic cordova prepare ios

回答by Shazron

Try removing the reference, and adding it again. Did you add it as a "Reference"? The icon should be in blue. Then clean and rebuild.

尝试删除引用,然后重新添加。您是否将其添加为“参考”?图标应该是蓝色的。然后清理并重建。

回答by Berti

You could also just drop the www folder w/Finder into the Xcode Nav tab (root), after that just check dialog checkboxes "Copy items into destination group's folder" and "Create folder references for any added folders".

您也可以将带有 Finder 的 www 文件夹拖放到 Xcode 导航选项卡(根)中,然后只需选中对话框复选框“将项目复制到目标组的文件夹”和“为任何添加的文件夹创建文件夹引用”。

回答by FrankW

I had the same problem where it worked in the simulator but not a device. My issue was case sensitivity. My file was Index.html instead of lower case index.html.

我在模拟器中工作但不是设备时遇到了同样的问题。我的问题是区分大小写。我的文件是 Index.html 而不是小写的 index.html。

回答by avoision

What versions of Xcode and PhoneGap are you using?

您使用的是什么版本的 Xcode 和 PhoneGap?

If you're using the older Xcode 3 and are creating a new project using the PhoneGap template... it should automatically create a wwwfolder for you, along with a generic index.htmlfile. If you've dragged your folder and index file intothe project, then you should have been overwriting the existing files.

如果您使用的是较旧的 Xcode 3 并且正在使用 PhoneGap 模板创建一个新项目......它应该会自动www为您创建一个文件夹以及一个通用index.html文件。如果您已将文件夹和索引文件拖到项目中,那么您应该已经覆盖了现有文件。

If you're using Xcode 4, there's a known issue with getting a PhoneGap project set up. It would be helpful to know what tutorial/guide you are following (assuming you are using a guide).

如果您使用的是 Xcode 4,则设置 PhoneGap 项目存在一个已知问题。了解您所遵循的教程/指南会很有帮助(假设您正在使用指南)。

In very random cases, changes you make to your files/folders directly (via Finder) might not be picked up immediately by Xcode. You could always try quitting out of Xcode and re-opening your project, to ensure Xcode is pulling the latest files.

在非常随机的情况下,您直接(通过 Finder)对文件/文件夹所做的更改可能不会立即被 Xcode 获取。您可以随时尝试退出 Xcode 并重新打开您的项目,以确保 Xcode 拉取最新文件。

回答by redolent

Well cordova build ios androidwas the only thing that worked for me, and cordova builddidn't cut it.

cordova build ios android是唯一对我有用的东西,并cordova build没有削减它。

回答by Zander Zhang

in xcode target - Copy Bundle Resource add www folder

在 xcode 目标中 - 复制捆绑资源添加 www 文件夹