Lose the Cables: Make Deploying to an iOS or tvOS Device Easier
One thing most developers consistently do during app development is deploy to a testing device. One main drawback during this process is the struggle to find a cable, connect it to a computer, plug it into a device, and then finally deploy the app. Furthermore, devices, especially personal devices, are often locked with a passcode. In fact, iOS requires a passcode in certain cases, such as adding a new wireless device or using Apple Pay.
With the introduction of Wireless Deployment and our new Unlock Device Alert, these are problems of the past.
When a device is connected wirelessly and ready to be used for deployment, it shows up in the IDE like so:
Since there are no project options to set manually, you won’t have to configure anything in Visual Studio for Mac. Everything is automatic, just as if the device were connected via USB. Breakpoints that were previously set will continue to work, because wireless debugging is automatically enabled after wireless deployment.
Connecting a Device
Connecting a device wirelessly has to be done through Xcode and the detailed instruction can be found in this documentation. When your iOS 11 device is connected via USB, Xcode 9+ will show you a “Connect via Network” checkbox in
Devices and Simulators. Simply click on this button and the device will appear in Visual Studio for Mac.
Since the new Apple TV 4K doesn’t have a USB-C port, wireless deployment is especially important on tvOS. The only way to deploy an app on tvOS is through Network.
Unlocking Device Alerts
Another improvement we’ve made when deploying to a device is the ability to detect that a device is locked. If it is, Visual Studio for Mac will show you an alert and ask you to unlock the device. This is a great addition, because it no longer prevents you from deploying by showing an error message. Now, after the device is unlocked, it will automatically launch the app and start debugging.
As you can see, the alert also gives you the option to Cancel, which stops the deployment and debugging session entirely:
If you don’t have the compatible Xamarin.iOS version, you’ll still get an improved deployment workflow, but won’t see an alert requesting to unlock your device. In order to resume the deployment process, Visual Studio for Mac will wait for you to unlock the device manually before launching the app and starting the debugging session. If you’re working on Windows, you’ll be happy to know that all of these features are available in the Visual Studio Preview.