As an iOS programmer, many times you will be annoyed with the mess of wires when you ban iOS devices from entering your device to debug things, including a bunch of devices: iPhone, iPad, iPod, Apple TV and Apple. Watch. So how to simplify it, Apple introduced us a nice new feature about wireless connectivity with Xcode in 2017.
There will be pros and cons to using wireless connectivity for debugging. In this article we will dig deep into this issue.
- Xcode 9.0 or newer to run on macOS 10.12.4 or higher
- Passcode (Password / Touch ID / Face ID) needs to be confirmed when connecting the device
Step 1: Connect i-Devices to Mac and press the
Step 2: Go to “Devices and Simulators” (Command + Shift + 2) in Xcode and i-Device must be seen in the list on the left.
Step 3: Stick to the “Connect via network” checkbox
Remember to make sure that you have set up the passcode (Passcode / Touch ID / Face ID) on i-Devices or this dialog will appear!
To set up the password, you can go to Settings> Face ID & Passcode session on iPhoneX or newer devices.
Step 5: Unplug the cord from the i-Device and connect to the same network with the Mac you are using. After a while of loading, you will see the “Network” icon placed next to the name of your phone and now you can deploy the app without distorting the wires.
So, what are their pros and cons? Let’s see:
- Can connect multiple devices (> 2): The number of connected devices will be limited to the number of ports plugged into your Mac. Take the 13 “Macbook Pro 2015 as an example, it only has 3 usb ports. With wireless connectivity, you won’t be limited by this problem. too great.
- No need to purchase additional USB-C to lighting adapter Developer will not need to purchase additional USB-C to Lightning cable to allow iPhone to connect to MacBook Pro (2017 or newer). According to information from the apple store, each plus this wire to USD $ 19 (Apple store: USB-C to lightning cable) if you want to buy “hanh”! (This seems like a bad design coming from Apple! The latest iPhone models can’t connect to the latest MacBook line and have to buy more wires! 😫)
- Longer load times:
Data transferred from the network will take longer than through the cable. After testing with 1 new project and 1 mid-range project. The difference in build time is huge and it is quite dependent on the size of the project. See the results below:
Empty project with 2.5 MB .ipa file (Time difference: 5s)
Mid-range project with 12.9 MB .ipa file (Time difference: 9s)
- Auto lock should be turned off
Wireless connection with iPhone will be disabled if the device is auto-locked. The default auto lock is 30 seconds. However, reconnecting after reopening the device will take more time and take us about 10 seconds. This is quite annoying if the dev is in a state of deadline to the ass.
Apple advised developers to turn this feature off by:
Settings > Display & Brightness > Auto-Lock > Never
However, this causes some long-term effects on the device and security issues when devices are still unlocked and used by others.
Wireless connection is an impressive feature for developers who are using the MacBook without banning the USB port, working with small projects and need to constantly change devices to test. However, we have to consider that it takes more time to reconnect and the build time will be longer. It can also cause screen life and security issues if you don’t notice it.
No solution is optimal. We can only choose to see which solution is best for us. I wish you happy.
My translation here is over Thank you for watching. Link to my translation: Xcode wireless debug tools
You can read more of the articles below by the author to understand more:
- Troubleshoot a wireless device (iOS, tvOS)
- Pair a wireless device (iOS / tvOS) with Xcode (iOS, tvOS) – Xcode Help
- Run an app on a wireless device (iOS, tvOS, watchOS)
Goodbye Hope to see you again someday noaaaaaaaaaaaaaaaaaaaaaaaaaaa. Thanks for watching my translation from the beginning till now