Xcode 9 无线调试不起作用

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

Xcode 9 Wireless debugging not working

iosxcode

提问by user2529173

For some reason the wireless debugging does not work here. Here is what I've done:

由于某种原因,无线调试在这里不起作用。这是我所做的:

  • Using newest Xcode 9
  • Using newest iOS 11 on my iPhone 7+
  • Both devices are in the same network
  • Connected the iPhone via Lightning, selected "Connect via Network" in the Devices & Simulator menu
  • Run an app on the iPhone while still connected via Lightning - everything works
  • 使用最新的 Xcode 9
  • 在我的 iPhone 7+ 上使用最新的 iOS 11
  • 两台设备在同一个网络中
  • 通过 Lightning 连接 iPhone,在“设备和模拟器”菜单中选择“通过网络连接”
  • 在 iPhone 上运行应用程序,同时仍通过 Lightning 连接 - 一切正常

But as soon as I unplug the phone, Xcode is no longer able to connect with the phone. I can ping the phone with the Mac, but even the "connect via ip" option in Xcode does not work.

但是一旦我拔掉手机,Xcode 就无法再与手机连接。我可以用 Mac ping 手机,但即使是 Xcode 中的“通过 ip 连接”选项也不起作用。

Anybody got tips on how to get this working?

有没有人有关于如何让这个工作的提示?

回答by Fuad Kamal

I had the same issue, but it was intermittent - i.e. sometimes the globe would not appear next to the phone name in Xcode Devices and Simulators window and when the phone was disconnected from the lighting cable, I could not debug to it from Xcode. My fix was much simpler, though - I just turned WiFi on and off both on the Mac and on the phone. After the devices reconnected to the network wireless debugging was available again. This seems to be an issue with the network communication (regardless whether the device can be pinged or not).

我有同样的问题,但它是间歇性的 - 即有时地球不会出现在 Xcode 设备和模拟器窗口中的电话名称旁边,当电话与照明电缆断开连接时,我无法从 Xcode 调试它。不过,我的修复要简单得多 - 我只是在 Mac 和手机上打开和关闭 WiFi。设备重新连接到网络后,无线调试再次可用。这似乎是网络通信的问题(无论设备是否可以 ping 通)。

回答by Matthew Korporaal

Make sure System Preferences->Internet Sharingis enabled using USB ports:

确保使用 USB 端口启用系统偏好设置-> Internet 共享

Sharing is caring

分享是关怀

回答by Vincent Spaziani

I was able to find a solution to this on another stack overflow question: How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?.

我能够在另一个堆栈溢出问题上找到解决方案: 如何在带有 iOS 11、Apple TV 4K 等的 Xcode 9 中执行无线调试?.

You can also check this answer: "Connect via network" wireless debugging not working Xcode 9

您还可以查看此答案:“通过网络连接”无线调试不起作用 Xcode 9

Near the bottom, from "IOS DEV". Briefly, the solution ended up to be to unpair my phone, disconnect and re-pair. After that Xcode automatically added it with the globe. As an FYI, I was able to ping my iPhone using the network utility prior to the un-paring but was still unable to get the phone to connect. good luck.

靠近底部,来自“IOS DEV”。简而言之,解决方案最终是取消我的手机配对,断开连接并重新配对。之后 Xcode 自动将它添加到地球上。作为仅供参考,我能够在取消配对之前使用网络实用程序 ping 我的 iPhone,但仍然无法连接手机。祝你好运。

回答by RawMean

Restarting xcode is the only thing that fixed this intermittent connectivity problem for me.

重新启动 xcode 是唯一为我解决这个间歇性连接问题的方法。

回答by Swindler

I realized this can also happen if my Mac is connected to a VPN. I had to:

我意识到如果我的 Mac 连接到 VPN,也会发生这种情况。我不得不:

  1. Kill the VPN connection
  2. Turn the computer's wifi off and back on
  3. Open Devices and Simulators
  4. Plug the device in and the globe icon should appear.
  5. Unplug the device and make sure the globe icon is still there.
  6. Run the app via network!
  1. 终止 VPN 连接
  2. 关闭计算机的 wifi 并重新打开
  3. 开放设备和模拟器
  4. 插入设备,应该会出现地球图标。
  5. 拔下设备并确保地球图标仍然存在。
  6. 通过网络运行应用程序!

回答by bruce1337

Wireless debugging mysteriously stopped working for me until I turned off my VPN client. I now believe that I had the VPN turned off when I was trying it out the first time, but then the VPN auto-connected after my computer restarted sometime later.

无线调试神秘地停止了对我的工作,直到我关闭了我的 VPN 客户端。我现在相信我在第一次尝试时关闭了 VPN,但后来我的计算机重新启动后 VPN 自动连接。