设备环境:Mac OSX 10.12.5、iOS11、Xcode9
PS:这是WWDC2017的新功能,iOS 11以上,Xcode 9这是硬性要求
手机连接上Xcode,打开Xcode菜单:Windows->Device and Simulators。找到连接上的设备,把Connect via network
选项打勾。

之后Xcode将会转一会圈圈,耐心等待一会就成功了,此时拔掉数据线,可以看到左侧的设备连接列表上手机仍在。

运行我们的项目,在设备列表中不出意外会看到我们的无线连接的手机。选择手机后运行

image.png
不出意外的话,此时是跑不起来的。还需要最后一步,回到刚刚的设备列表中,选中手机右键,在出来的选项卡中选择一个Connect via IP Address项。选择之后输入手机的局域网ip地址。


完成后可以看到在连接的手机右边有一个地球连接标志,长这样:

以后项目运行,在下拉列表如果手机在局域网中也会有这个标志:

最后一步,选择后直接运行,不出意外的话,项目无需数据线就跑起来了

另外:此方法是支持无线调试的,连一次以后就不需要数据线了了~

提示:此方式仅适用局域网内。
网友评论