简体   繁体   English

iOS模拟器无法连接到本地IP地址

[英]iOS simulator cant connect to local network IP address

To start, I used to be able to access locally hosted files on my simulator app with no problem. 首先,我曾经能够毫无问题地访问模拟器应用程序上的本地托管文件。

After updating to OS X Yosemite, I can't connect to addresses like http://192.168.2.6:8000 on my iOS simulator, that work fine in Chrome, or from my actual phone. 更新到OS X Yosemite后,我无法连接到iOS模拟器上的http://192.168.2.6:8000地址,该地址在Chrome或我的实际手机上都能正常工作。

Is there a new setting I need to enable for local testing? 是否需要启用本地测试的新设置? Or are there any other potential issues for me to look at? 还是我需要考虑其他潜在问题?

The error I get on safari (on iOS simulator) is: 我在野生动物园(在iOS模拟器上)遇到的错误是:

The error was: "The operation couldn't be completed. No such file or directory".

And looking in the system.log I see this: 并查看system.log,我看到了:

Oct 13 16:40:46 My-MacBook-Pro MobileSafari[4215]: tcp_connection_set_tfo 89 TFO is not yet supported on Simulator

This problem solved completely with iOS 9.2 and Xcode 7.2 : https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html#//apple_ref/doc/uid/TP40016994-CH5-SW2 使用iOS 9.2和Xcode 7.2可以完全解决此问题: https : //developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html#//apple_ref/doc/uid / TP40016994-CH5-SW2

However, based on official releases notes of Xcode 7.2, it is still known issue for previous iOS versions (I checked it for iOS 8.2, but there is no problem anymore). 但是,根据Xcode 7.2的官方发行说明,对于以前的iOS版本,这仍然是已知问题(我在iOS 8.2中对其进行了检查,但现在不再存在问题)。 You could use your loopback address (127.0.0.1 or localhost) for older versions. 对于较早的版本,可以使用回送地址(127.0.0.1或localhost)。

This is a known issue that I believe was mentioned in the Xcode release notes. 我相信这是Xcode发行说明中提到的已知问题。 Unfortunately, the only workaround at this time is to user the loopback interface (ie: 127.0.0.1) for your testing needs. 不幸的是,目前唯一的解决方法是使用环回接口(即:127.0.0.1)来满足您的测试需求。

Sounds to me like a warning that http is going to be frowned on. 在我看来,这就像一个警告,即将http皱起来。 eg: 例如:

in UIWebView you cannot open, by default, an http// web-page 在UIWebView中,默认情况下无法打开http //网页

if you then open an https// web-page it opens but any images,etc. 如果您随后打开https //网页,则会打开,但会显示任何图像等。 in it that refer to http// websites fail to load 在其中引用http //网站无法加载

I've just dealt with all that stuff, it certainly happens with the latest mac OS and the latest Xcode 我已经处理了所有这些内容,这肯定是在最新的Mac OS和最新的Xcode中发生的

Phil 菲尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM