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


当前回答

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

其他回答

设置网络调试设备

从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 Help -> Run and debug -> Network debugging获取更多信息。希望能有所帮助。

先决条件

您的Mac机器应该至少有Mac OSX 10.12.4或更高版本 您的iOS设备应该至少有iOS 11.0或更高版本 两台设备应该在同一网络上。

激活步骤

通过电缆将你的iOS设备与Mac电脑连接起来。 然后从顶部菜单窗口>设备和模拟器打开Xcode 选择设备段,并从左侧设备列表中选择所需的设备。 在右边,你可以看到打开通过网络连接,启用这个选项,如图所示。 几秒钟后,您可以看到网络标志在您的设备前面。 拔掉设备的插头,像正常使用一样使用调试。

谢谢

我尝试过使用Xcode设备窗口的连接网络选项。但我无法看到设备名称旁边的“已通过网络连接”图标。同时,一旦移除USB,“通过网络连接”选项就会消失。此外,设备名称出现在断开连接的设备列表下。

但是使用“通过IP地址连接…”选项,我能够连接。

右键单击设备名称(在断开连接列表下)并选择“通过IP地址....连接”选项。

输入设备的IP地址,选择“连接”。(您可以通过移动设备设置> Wi-Fi >选择wifi名称)

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

在Mac

OR

在iPhone上,

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

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