Urgent.News

What's breaking now, across thousands of outlets.

Tech

Debugging an iPhone From Windows Over USB: Screenshots and Logs With Python

On Android, adb makes it easy to take a screenshot or read a log from a phone on your desk. I expected nothing like it for an iPhone on Windows, but there is a way: Apple's own driver package plus an open source Python tool. Here is the setup that worked on an iPhone 7 running iOS 15.8, the traps in the order I hit them, and a real bug I solved with it. What you need The Apple Devices app from…

To take a screenshot or read logs from an iPhone on Windows, you need the Apple Devices app from the Microsoft Store, Python 3 and the pymobiledevice3 package. The phone must be unlocked with its screen, and a USB cable connected. Begin by installing the Apple Devices app, which includes the USB driver for iPhones. Then, open the app, accept the Trust prompt, and let it install the drivers. After that, the phone should list correctly in Device Manager.

The Python trap arises because Windows may default to an older Python 2.7 version. To avoid this, use the py launcher to install the pymobiledevice3 package with the command py -3 -m pip install pymobiledevice3. Always run the tool as py -3 -m pymobiledevice3, as it creates an executable not on the path.

Once set up, you can use several commands:

- usbmux list shows the connected phone with its model and iOS version.

- mounter auto-mount downloads and mounts the developer disk image once.

- developer dvt launch followed by the bundle identifier starts your app.

- developer screenshot followed by a file name saves the current screen capture.

Reading the log can become overwhelming, so filter it by process name to focus on your app's output. My app generated more than a megabyte of log data in thirty seconds, so I wrote the output to a file and searched it later for messages with my app's name tagged.

For instance, my game's banner was empty after switching ad units. Without the log, I might have spent time hunting for a code bug. The log showed a single line: no ad to show, which was expected as the ad server had nothing to display for a new ad unit in an app not yet in the store. Always remember to launch your own app first and filter the log by its process name if the phone is shared. By trusting your computer, you can securely connect and read data over USB.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Rewriting for Kotlin Multiplatform Without Changing Behavior: Old Code as a Test Oracle

I moved two small RSS reader apps and a space app to Kotlin Multiplatform so they could also run on iOS. That meant rewriting code that leaned on Android and Java classes.

  • Migrated RSS reader apps and space app to Kotlin Multiplatform for iOS compatibility
  • Preserved old implementations in test sources as a test oracle for comparison
  • Developed custom Random algorithm to maintain space app's daily card consistency

Shipping an iPhone App Without a Mac: Kotlin Multiplatform, a Cloud Mac and TestFlight

I develop on Windows and I do not own a Mac, but I wanted my small Android game 2048 on the App Store. It turns out you do not need a Mac on your desk, only one in the cloud for a few minutes per…

  • Windows developer can ship iOS app via cloud-based solution
  • Kotlin Multiplatform, cloud Mac, and TestFlight used for development
  • Android and iOS shells are thin wrappers around shared Kotlin code

App Store Screenshots Without a Phone: Robolectric, a Fake Image Loader and a Headless Browser

My iPhone apps share their screens with the Android versions, written once in Compose. App Store Connect wants screenshots at 1206x2622 pixels, and I work on a Windows laptop with no iPhone to spare…

  • Robolectric runs Android code on JVM for screenshot generation
  • Roborazzi saves bitmap images as PNG files for App Store Connect
  • Headless Edge renders WebView pages for accurate representation

More from Monday 16 November →