xcode 无法加载网页,错误:在此服务器上找不到请求的 URL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12885267/
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-09-15 01:49:28  来源:igfitidea点击:

Failed to load webpage with error: The requested URL was not found on this server

iosiphonexcodecordova

提问by Garrett

I'm experiencing a weird error with my PhoneGap app: every odd time I run the simulator (or the test deployed app on my phone), I get the error

我的 PhoneGap 应用程序遇到一个奇怪的错误:每次我运行模拟器(或测试部署的应用程序在我的手机上)时,我都会收到错误消息

Failed to load webpage with error: The requested URL was not found on this server.

It works every even time I run the simulator. This has been happening since I first deployed my app. I was not using any plugins at the time, but since then I've been trying to get the Facebook iOS SDK working, and this probably isn't related but the times that my app actually succeeds to start up, I can't click anything.

每次我运行模拟器时它都可以工作。自从我第一次部署我的应用程序以来,这种情况一直在发生。我当时没有使用任何插件,但从那以后我一直在尝试让 Facebook iOS SDK 工作,这可能无关但我的应用程序实际上成功启动的时间,我无法点击任何事物。

God help me.

神救救我。

This ismy first time building an iOS app, so this is probably a newbie mistake - before this my app was just a mobile website.

我第一次构建 iOS 应用程序,所以这可能是一个新手错误 - 在此之前我的应用程序只是一个移动网站。

采纳答案by Garrett

It was a javascript redirect that was causing this. Avoid using window.location = ???on the initial pageload at all costs in PhoneGap :)

这是导致此问题的 javascript 重定向。window.location = ???不惜一切代价避免在 PhoneGap 的初始页面加载上使用:)

回答by attractgold007

I just experienced this issue. The Urls are case sensitive. So if you have Login.htmlas the file name, it shouldn't be login.htmlin the code.

我刚刚经历了这个问题。Urls 区分大小写。所以如果你有Login.html作为文件名,它不应该login.html在代码中。

回答by user1638126

kill -9 ps ax | grep Simulator | grep -v grep | awk '{print $1}'

kill -9 ps ax | grep Simulator | grep -v grep | awk '{print $1}'

Try this line on the terminal and then run. Maybe there is a problem in simulator, it will resolve

在终端上试试这一行,然后运行。也许模拟器有问题,它会解决

回答by Federico

I had the same issue. However, it was a different cause.

我遇到过同样的问题。然而,这是一个不同的原因。

We have a webapp that uses clean urls. We use htaccess to automatically check for .html. That way our links in the code/url are just myapp.com/page1 vs myapp.com/page1.html

我们有一个使用干净 url 的 web 应用程序。我们使用 htaccess 自动检查 .html。这样我们在代码/网址中的链接就是 myapp.com/page1 vs myapp.com/page1.html

This caused me about an hour of headaches, as I began exploring the port over to phonegap. Nothing would work. I was brand new to phonegap, so I wasn't sure what it was. I did the whitelist, external hosts, etc. Then I realized I dont have the htaccess file in the phonegap directory and that I need complete links.

当我开始探索端口到 phonegap 时,这让我头疼了大约一个小时。什么都行不通。我是 phonegap 的新手,所以我不确定它是什么。我做了白名单、外部主机等。然后我意识到我在 phonegap 目录中没有 htaccess 文件,我需要完整的链接。

I know its specific. But for what its worth, there you have it.

我知道它的具体。但无论其价值如何,您都拥有它。