无线调试是最近在Xcode 9、iOS 11和tvOS 11中添加的功能。苹果4K电视没有USB接口,因此需要无线调试。如何在Xcode中进行无线调试?


当前回答

对于无线调试,Mac系统和iPhone/Device应该在同一个网络上。 在同一个网络上,你可以做- 你可以在Mac上启动热点,然后在iPhone/设备上连接,反之亦然。

在Mac

OR

在iPhone上,

Xcode►窗口►设备和模拟器►选择设备标签►点击连接 通过网络

https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/devbc48d1bad

其他回答

我试了所有的答案,但没有一个对我有效。我最终连接到不同的WiFi网络,然后我就可以无线调试了。

我不知道为什么它不能在旧的网络上工作

设置网络调试设备

从help.apple.com

通过Wi-Fi或其他网络连接调试在iOS或tvOS设备上运行的应用程序。

设置iPhone、iPad或iPod touch的步骤

检查你的设备是否有密码,如果没有就添加一个。您的设备必须有密码才能启用远程调试 Mac和iPhone/iPad需要在同一个网络上才能使用无线调试。

接下来,在Xcode中

选择窗口>设备和模拟器,然后在出现的窗口中单击设备。 使用Lightning电缆将您的设备连接到Mac。 在左侧列中选择设备,在详细信息区域中选择“通过网络连接”。

Xcode与你的设备配对。如果Xcode可以通过网络连接到设备,则在设备的左列中会出现一个网络图标。

断开设备连接。

现在可以通过网络进行调试了。

有时候行不通。您可能需要重新启动设备或网络连接。

注意:网络调试需要在macOS 10.12.4及以上版本上运行Xcode 9.0及以上版本,在设备上运行iOS 11.0及以上版本,或tvOS 11.0及以上版本。


安装Apple TV的步骤:

Make sure your Mac and your Apple TV are on the same network. Choose Window > Devices and Simulators, then in the window that appears, click Devices. On your Apple TV, open the Settings app and choose Remotes and Devices > Remote App and Devices. The Apple TV searches for possible devices including the Mac. (If you have any firewall or Internet security, disable/turn it off to allow searching.) On your Mac, select the Apple TV in the Devices pane. The pane for the Apple TV is displayed and shows the current status of the connection request. Enter the verification code displayed on your AppleTV into the Device window pane for the device and click Connect.

Xcode设置Apple TV进行无线调试,并与设备配对。

将无线设备与Xcode配对(iOS, tvOS)

唯一能让它工作的方法就是我的Mac和iPhone连接到不同的网络上。我有一个主DSL调制解调器,称为network1,第二个network2为我们设置了一个接入点。他们有ssid network1和network2。如果电话在网络1上,mac在网络2上,它就可以工作,反之亦然。但是如果两者都在网络1上,或者两者都在网络2上,它就不能工作。

你可以打开Xcode Help -> Run and debug -> Network debugging获取更多信息。希望能有所帮助。