xcode 无法在 iOS 8 模拟器中使用 HTTP

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

Can't use HTTP in iOS 8 simulator

iosxcodeios8ios-simulator

提问by BobDave

I have installed xcode 6, beta 7 on a MacBook Pro. When I try to use the iOS simulator running iOS 8, and try to connect to any site that is not using HTTPS, I get a blank page stating that "Safari cannot open the page because the network connection was lost" in the simulator. Any page that uses HTTPS works fine.

我已经在 MacBook Pro 上安装了 xcode 6, beta 7。当我尝试使用运行 iOS 8 的 iOS 模拟器并尝试连接到任何未使用 HTTPS 的站点时,我在模拟器中看到一个空白页面,指出“由于网络连接丢失,Safari 无法打开该页面”。任何使用 HTTPS 的页面都可以正常工作。

I have tried various solutions for problems like this, but none of them have worked. These various solutions include restarting the Mac, uninstalling xcode 6 and reinstalling it, and all the proposed solutions in these 2 links:

对于此类问题,我尝试了各种解决方案,但没有一个奏效。这些不同的解决方案包括重新启动 Mac、卸载 xcode 6 并重新安装它,以及以下 2 个链接中所有建议的解决方案:

Unable to run app in Simulator : Xcode beta 6 iOS 8

无法在模拟器中运行应用程序:Xcode beta 6 iOS 8

Unable to run app in Simulator : Xcode beta 6 iOS 8

无法在模拟器中运行应用程序:Xcode beta 6 iOS 8

回答by Bek

I just ran across this response from an Apple employee regarding the issue in the Apple forums:

我刚刚在 Apple 论坛上看到了一位 Apple 员工对这个问题的回应:

There is a known issue whereby changes in the host's network configuration (changing wireless networks, changing from wireless to wired, etc) will result in the simulated runtime appearing to loose network connectivity for some cases. The workaround is to just reboot the simulated device.

有一个已知问题,即主机网络配置的更改(更改无线网络、从无线更改为有线等)将导致模拟运行时在某些情况下似乎失去网络连接。解决方法是重新启动模拟设备。

Restarting the simulator did make my issue go away for some amount of time, but it looks like I need to reboot my simulator any time the Mac changes wifi networks or wakes up. Hopefully they'll release a fix soon, it makes testing impossible. https://devforums.apple.com/message/1048174#1048174

重新启动模拟器确实让我的问题消失了一段时间,但看起来我需要在 Mac 更改 wifi 网络或唤醒时重新启动模拟器。希望他们能尽快发布修复程序,这使测试变得不可能。 https://devforums.apple.com/message/1048174#1048174

回答by StevenDavisPhoto

Downgrading to iOS Simulator 7.x works too.

降级到 iOS Simulator 7.x 也可以。