Debug your iOS native code with Mac Console
I work in React Native, and so I’m used to starting an app in the iOS simulator so that I can see my Javascript console.logs coming through into a browser console or in the terminal. However, sometimes the code your debugging is in native code.
Here’s how to see logs from native iOS code.
Make sure you’re logging something
In Native code…
import OSLog
let logger = Logger(subsystem: "com.yourcompany.yourapp", category: "yourCategory")
Subsystem: A reverse DNS string that identifies your app or a specific part of it.category: A string that categorizes the log messages within your subsystem (e.g., “Networking”, “UI”, “DataPersistence”).
Example use:
logger.trace("This is a trace message.")
logger.debug("This is a debug message.")
logger.info("This is an info message.")
logger.notice("This is a notice message.")
logger.warning("This is a warning message.")
logger.error("This is an error message: \(error.localizedDescription)")
logger.critical("This is a critical error, potentially leading to a crash.")
View the logs
One you’re running your app on device, you can view the logs by opening the console.
- Cmd+Space
- Type console
There are a probably a lot of other logs coming through, so use the filter settings to limit logs by subsystem or category.
That’s it!
Thanks…
I also dissect and speculate on design and development.
Digging into subtle details and implications, and exploring broad perspectives and potential paradigm shifts.
Check out my conceptual articles on Substack or find my latest below.
You can also find me on Threads, Bluesky, Mastodon, or xTwitter for more diverse posts about ongoing projects.

Leave a Reply