The iOS Web Debugger for Visual Studio Code is the latest attempt by Microsoft to woo iOS developers.
Looking to woo Apple iOS developers, Microsoft is enhancing its Visual Studio Code editor this week with the capability to debug JavaScript code for iOS mobile devices.
The iOS Web Debugger for Visual Studio Code is an extension supported on both Mac and Windows PCs that enables developers to debug JavaScript code running in the Safari browser on iOS devices.
Until now, the ability to debug websites running on iOS devices has only been available to a subset of developers, said Kenneth Auchenberg, program manager for dev tools and remote debugging at Microsoft. “For example, using the Safari Web Inspector (Safari DevTools) requires an instance of desktop Safari that only is available for MacOS users,” he said. “Today, we’re enabling mobile web developers to debug JavaScript running on their iOS devices directly from their editor.”
The extension operates in two modes: launching a URL on a Safari device or attaching to a running tab inside Safari. Two open source projects, ios-webkit-debug-proxy, and ios-webkit-debug-proxy-win32 are used for connecting from Microsoft’s debugging library to the iOS device. These projects enable communication with iOS devices over USB via the WebKit Remote Debugging Protocol. “The protocol is compatible with the Chrome Debugging Protocol for the script debugging APIs, and this means our debugger works without additional mapping logic,” Auchenberg said.
Features supported in the extension include setting of breaking points, stack traces, debugging of eval scripts, and virtual forwarding via HTTP tunnel from the local PC. Auchenberg explained that it’s cumbersome to enable mobile devices to access a local development server. “To make this easier, platforms like Android support point-forwarding natively, but iOS doesn’t support this.” Instead, Microsoft emulates port-forwarding by adding an option to start an instance of localtunnel, which creates an HTTP tunnel from a local computer to the public internet for a specified TunnelPort property. The HTTP tunnel is used by the iOS device to access the local development server.
Microsoft has been courting iOS developers of late. The planned Visual Studio 15 platform has been fitted with a capability to import Xcode projects that leverage C++. The company also acquired cross-platform mobile development tools vendor Xamarin, which supports iOS.