If you follow Build iOS Apps on Windows Without a Mac, you can build and install real iPhone apps from a Windows PC. The first time your app crashes, you'll miss one thing: Xcode's debugger.
You don't need it. Between the iPhone itself, a few free Windows tools and good logging in your code, you can find almost any bug. Here's the toolkit.
The debugging toolkit at a glance
| Problem | Tool | Works from Windows? |
|---|---|---|
| See what the app prints while running | idevicesyslog (libimobiledevice) | Yes |
| Find out why the app crashed | Crash reports on the iPhone | Yes, from the phone |
| Show errors to yourself while testing | An in-app debug screen | Yes |
| See API requests and responses | An HTTPS debugging proxy | Yes |
| Catch compile errors | GitHub Actions build log | Yes |
Four free sources of truth cover almost every bug: logs, crash reports, network traffic and build logs.
1. Add good logging first
Every other tool works better if your app logs what it's doing. Use Apple's OSLog Logger, which is fast and shows up in the device's system log:
import OSLog
extension Logger {
static let app = Logger(subsystem: "dev.pawanjoshi.HelloPhone", category: "app")
static let network = Logger(subsystem: "dev.pawanjoshi.HelloPhone", category: "network")
}
// Usage
Logger.network.info("Loading notes")
Logger.network.error("Request failed: \(error.localizedDescription, privacy: .public)")Two tips:
- Use levels:
debugfor detail,infofor normal events,errorfor failures. - By default, dynamic values are hidden as
<private>in logs. Addprivacy: .publiconly for values that aren't personal, like status codes or error messages.
2. See live logs on Windows with idevicesyslog
libimobiledevice is a free, open-source set of tools that talk to iPhones over USB. Its idevicesyslog command streams the phone's system log, including your Logger messages, to your Windows terminal.
- Install the Apple USB drivers (iTunes from apple.com or the Apple Devices app), which you already have if you use Sideloadly.
- Download a Windows build of libimobiledevice and add its folder to your
PATH. - Connect the iPhone, unlock it, and trust the computer.
- Run:
idevice_id -l # should print your iPhone's ID
idevicesyslog --match HelloPhone # stream only lines containing your app's nameNow open the app on the phone and watch your log lines appear live. Filter by your subsystem or a word you log, because the full system log is very noisy.
What idevicesyslog looks like: INFO lines in green and the failing request in red.
3. Read crash reports on the iPhone
When an app crashes, iOS saves a report. You can read it without a Mac:
- On the iPhone, open Settings → Privacy & Security → Analytics & Improvements → Analytics Data.
- Find a file starting with your app's name and the crash date.
- Open it and use the share button to AirDrop or email it to yourself.
What to look for in the report:
- Exception Type, for example
EXC_CRASH (SIGABRT)orEXC_BAD_ACCESS. - Termination Reason, which often states the cause directly, for example a missing privacy description.
- The crashed thread's backtrace. Look for lines with your app's name. Without symbols you'll see addresses instead of function names, but the reason fields usually tell you enough.
4. The most common crashes and their fixes
| What you see | Likely cause | Fix |
|---|---|---|
| App closes instantly when opening camera or mic | Missing usage description | Add NSCameraUsageDescription, NSMicrophoneUsageDescription and similar to Info.plist |
Fatal error: Unexpectedly found nil | Force-unwrapping a nil value with ! | Use if let, guard let or ?? |
Index out of range | Reading an array position that doesn't exist | Check indices.contains(i) or use first and last |
| Crash after a network call | Updating UI from a background thread or decoding unexpected JSON | Mark UI models @MainActor; make decoding errors throw and handle them |
| App won't open at all after a week | Free signing certificate expired | Re-sign and install with Sideloadly |
5. Build an in-app debug screen
When you test on your own phone, the fastest debugger is one inside the app. Keep the last few errors in memory and show them on a hidden screen:
import SwiftUI
@Observable
final class DebugLog {
static let shared = DebugLog()
private(set) var entries: [String] = []
func add(_ message: String) {
let time = Date.now.formatted(date: .omitted, time: .standard)
entries.insert("\(time) \(message)", at: 0)
if entries.count > 100 { entries.removeLast() }
}
}
struct DebugView: View {
let log = DebugLog.shared
var body: some View {
List(log.entries, id: \.self) { Text($0).font(.caption.monospaced()) }
.navigationTitle("Debug log")
}
}Open it with a long-press on your app's title, and wrap it in #if DEBUG so it never ships in a release build.
6. Inspect network calls with a proxy
Many bugs are really API problems: a wrong URL, a missing header, a 401. A debugging proxy on Windows shows every request your iPhone makes.
Tools like mitmproxy (free and open source), Fiddler or Proxyman run on Windows. The setup is similar for all of them:
- Start the proxy on your PC and note its port, for example
8080. - Make sure the iPhone and PC are on the same Wi-Fi.
- On the iPhone: Settings → Wi-Fi → (i) next to your network → Configure Proxy → Manual, then enter your PC's IP address and the port.
- Install the proxy's certificate on the iPhone from the address the tool gives you, then enable it in Settings → General → About → Certificate Trust Settings.
- Open your app and watch the requests and responses appear.
When you're done, turn the proxy off and remove the certificate from the phone. Only do this on your own device and your own apps.
The proxy sits in the middle, so you can read every request and reply.
7. Read build errors in GitHub Actions
Compile errors show up in the workflow log, not on the phone. In the failed step, search for error:. Each error names the file and line:
/Users/runner/work/HelloPhone/HelloPhone/ContentView.swift:14:22: error: cannot find 'tap' in scopeKeep changes small and push often, so each failed build points to one recent change.
A simple debugging routine
- Reproduce it. Write down the exact steps that cause the bug.
- Watch the logs with
idevicesyslogwhile you repeat the steps. - If it crashes, read the crash report's termination reason.
- If it's data, check the network calls in the proxy.
- Fix, push, rebuild, reinstall, and confirm the steps no longer cause the bug.
Key takeaways
- Add
Loggercalls first. Every other tool works better with good logs. idevicesyslogstreams your logs to Windows, and the crash report's Termination Reason usually names the cause.- A proxy shows API problems that logs can't, such as a wrong URL or missing header.
Next, connect your app to a real backend in Call a Serverless API from SwiftUI with async/await.
Found this useful?
Share it with your group