How to debug iOS app on Windows
Show
In the world of app development and testing, cross platform testing has become a fixture in QA pipelines. This is done to ensure that the application works flawlessly across all the operating systems and mobile devices. However, QAs may not always have the requisite devices on hand for testing. For example, they may not have all the necessary iOS devices on which to test an iOS app. For example, they might have to test iOS apps on a Windows PC because that is all they can access at the moment. This article will explore how to do exactly that. It will outline two methods – using the XCode simulator and using the real iOS devices on the BrowserStack cloud. Method 1: Using the XCode SimulatorSo let’s have a look at the process of setting up an iOS simulator. This will enable users to test any iOS app on a Windows device. Follow the steps below to tests iOS apps on XCode simulator: Download the Xcode simulator and start by creating a project. You can build and run your app on a simulated or real device without writing code. You can connect a real device to your Mac using a cable, or for iOS or tvOS apps, connect it over Wi-Fi after you pair it with Xcode. For macOS apps, choose a scheme, then click the Run button in the toolbar.
A scheme is a collection of settings that specify the targets to build, the build configuration, and the executable environment for an app. There’s a scheme for each product (app, library, or framework) in your project. For projects that build an app, choose the scheme that matches your app’s name from the scheme menu in the toolbar. For watchOS apps, choose the WatchKit App target as the scheme. Now, select a simulator. For iOS, and watchOS apps, you can choose a simulated device, under [Platform] Simulators, from the run destination menu next to the scheme menu in the toolbar. Next step is to select a real device. Before distributing the application, launch it on a real device. Connect the device to your Mac, and choose the device in the run destination menu. If you choose a real device, add your Apple ID in Accounts and assign the project on the Signing & Capabilities window pane of the project editor. For macOS apps, code sign the app by enabling certain capabilities. Click the Run button to build and run the app on the selected simulated or real device. VIf the build is successful, Xcode runs the app and opens a debugging session in the debug area. Use the controls in the debug area to step through your code, inspect variables, and interact with the debugger. If the build is unsuccessful, click the indicators in the activity area to read the error or warning messages in the Issue Navigator. Alternatively, choose View > Navigators > Show Issue Navigator to view the messages. Now let’s understand how to test an iOS app on a Windows machine using Browserstack’s real device cloud. Be it manual or automated app testing, QAs can utilize BrowserStack’s infrastructure to get 100% accurate results in real-world circumstances. Test Apps on Real Mobile Devices Method 2: Test iOS apps on Windows using BrowserStackThere are two ways to test iOS apps on Windows – Manual App Testing (that is testing an iOS app on your physical Windows PC) and Automated App Testing. We will be discussing the automation approach in detail.
Before writing the final test case, you need to configure your test case by giving details to the following:
Now let’s code the program. package ios; import java.net.URL; import java.util.List; import java.net.MalformedURLException;; import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import io.appium.java_client.MobileBy; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.ios.IOSElement; public class BrowserStackSample { public static void main(String[] args) throws MalformedURLException, InterruptedException { DesiredCapabilities caps = new DesiredCapabilities(); // Set your access credentials caps.setCapability("browserstack.user", "Username"); caps.setCapability("browserstack.key", "Password"); // Set URL of the application under test caps.setCapability("app", "bs://444bd0308813ae0dc236f8cd461c02d3afa7901d"); // Specify device and os_version for testing caps.setCapability("device", "iPhone 12 Pro Max"); caps.setCapability("os_version", "14"); // Set other BrowserStack capabilities caps.setCapability("project", "First Project"); caps.setCapability("build", "Java iOS"); caps.setCapability("name", "first_test"); // Initialise the remote Webdriver using BrowserStack remote URL // and desired capabilities defined above IOSDriver You can also download the file and save it in order to upload it to App Live for real-time testing on iOS. Now, execute the program using the below command on the command line. mvn test -P Also, you can go to App live and upload this file to run the test on the device that you prefer. Now that you have an iOS app ready, you can deploy this into the windows platform to test the application and check for its compatibility. Now, let’s launch the Live Browserstack tool to test the application on windows. Upload the application developed and set the windows environment you want to test the application in. This example uses Windows 10 and Chrome 94. Output goes like this:
However, to take full advantage of its features, tests must be run on real mobile devices (iOS, Android, Windows, etc.) There is no way to accurately identify all possible bugs without testing apps in real user conditions, and that is where BrowserStack App Automate comes in.BrowserStack’s real device cloud offers thousands of real mobile devices from major vendors and manufacturers for app testing (manual and automated). Each device is loaded with real operating systems – multiple versions of popular operating systems in use. Essentially, QAs can access thousands of popular mobile device-OS combinations to test their app. They don’t have to worry about buying and updating devices and installing software. They just need to sign up for free, choose the required device-OS combination and start testing their app. Can I debug iOS app on Windows?Also, you can go to App live and upload this file to run the test on the device that you prefer. Now that you have an iOS app ready, you can deploy this into the windows platform to test the application and check for its compatibility. Now, let's launch the Live Browserstack tool to test the application on windows.
How do I debug an installed iOS app?Steps to connect when the application is installed but not in running mode. Application is installed either on a simulator or on the device.. Select Debug option from XCode Menu.. Select Attach to Process by PID or Name.. You'll get a popup, where by entering PID or name you can attach to the debugger.. Is there USB debugging on iOS?Using Safari Remote Debugging
Apple's iOS 6 update introduced Safari Remote Debugging, which allows you debug web pages in the Safari app on iOS devices. To get started, follow the steps below: Connect your iOS device to your machine via USB cable. On your device, open the Settings app.
Can I use Xcode on Windows?Given that Xcode works only on macOS, a solution to get Xcode on Windows would be to install macOS on a Windows PC by means of a virtualization app such as VMware or VirtualBox. Using a virtualization platform provides users with the full functionality of Xcode on your Windows machine.
|