简体   繁体   English

iOS模拟器上没有网络连接,仅与我的应用程序连接

[英]No network connectivity on iOS simulator but just with my app

I have no network connectivity when debugging my application in the Xcode simulator. 在Xcode模拟器中调试应用程序时,我没有网络连接。 The weird thing about this is: 奇怪的是:

  • I have connectivity in system apps like Safari 我在Safari之类的系统应用中具有连通性
  • My colleagues don't have the same problem 我的同事没有同样的问题

I've gone to the lengths of uninstalling Xcode and clearing every cached directory I can think of but to no avail. 我花了很多时间来卸载Xcode并清除我能想到的所有缓存目录,但无济于事。

Has anyone faced this? 有人面对过吗? Does anyone have any clue what might cause it? 有谁知道这可能是什么原因吗?

The Simulator uses the iOS/tvOS/watchOS userspace on top of the host mac kernel, so network connectivity in the Simulator is whatever connectivity your mac has. Simulator在主机mac内核之上使用iOS / tvOS / watchOS用户空间,因此Simulator中的网络连接就是您的Mac具有的任何连接。 If Safari inside the Simulator is succeeding then it is likely that you are running into App Transport Security or you are on a corporate network configuration that requires some special configuration or is blocking non-HTTP traffic. 如果模拟器中的Safari成功,则可能是您正在运行App Transport Security,或者您处于需要某些特殊配置或阻止非HTTP流量的公司网络配置中。 (I've also seen third party kernel extensions break the Simulator quite often, eg Virus Scanners). (我也看到第三方内核扩展经常破坏模拟器,例如病毒扫描程序)。

You may be able to diagnose further by adding a WKWebView to your app, then see if that web view is able to load a public website over HTTPS. 您可以通过将WKWebView添加到您的应用程序来进一步诊断,然后查看该Web视图是否能够通过HTTPS加载公共网站。

If it still isn't working for you please run xcrun simctl diagnose and attach to a bug report at https://bugreport.apple.com so we can take a look. 如果仍然无法使用,请运行xcrun simctl diagnose并附加到https://bugreport.apple.com上的错误报告,以便我们进行查看。

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

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