OS_ACTIVITY_MODE with the value disable. To keep device logs, set it to ${DEBUG_ACTIVITY_MODE} and define that user-defined build setting as disable only for Any iOS Simulator.Why this happens
Starting with Xcode 8 and iOS 10, Apple moved system logging to the unified logging system. When you run an app, the console can fill with lines you never wrote, such as:
subsystem: com.apple.UIKit, category: HIDEvents, enable_level: 0, persist_level: 0, default_ttl: 0 ...
Created DB, header sequence number = 248
bundleid: com.appc.TestiOS10, enable_level: 0, persist_level: 0, propagate_with_activity: 0
These lines are diagnostic output from system frameworks (UIKit, BaseBoard, FrontBoard) as they set up logging categories. They are not errors, and your app is not misbehaving. They are just noise that buries your own print and NSLog output.
The environment variable OS_ACTIVITY_MODE controls whether this activity tracing output is emitted. Setting it to disable in your run scheme hides it.
How to fix it
1. Disable OS_ACTIVITY_MODE in the scheme (quick fix)
- In Xcode, choose Product > Scheme > Edit Scheme… (or press Cmd+<).
- Select Run in the left sidebar.
- Open the Arguments tab.
- Under Environment Variables, click +.
- Set Name to
OS_ACTIVITY_MODEand Value todisable. - Make sure the checkbox next to it is ticked, then close the dialog and run again.
The system noise disappears from the console.
Downside: this setting applies to every run of that scheme, including runs on a physical device. On a device, OS_ACTIVITY_MODE=disable can also suppress your NSLog output in the Xcode console. If you rely on device logs, use the next approach.
2. Disable it only for the simulator
This keeps device logging intact and silences the simulator only. It uses a user-defined build setting that has a different value per SDK.
Step A: reference a build setting from the scheme
- Go to Product > Scheme > Edit Scheme… > Run > Arguments.
- Add the environment variable
OS_ACTIVITY_MODE. - Set its value to:
${DEBUG_ACTIVITY_MODE}
Step B: define the build setting
- Select your project, then your app target, then Build Settings.
- Click + and choose Add User-Defined Setting.
- Name it
DEBUG_ACTIVITY_MODE. - Expand the setting. Click the + next to Debug to add a platform-specific value.
- In the dropdown, choose Any iOS Simulator.
- Set its value to
disable.
Now, in Debug builds for the simulator, OS_ACTIVITY_MODE resolves to disable. On a device the setting has no value, so the variable is effectively empty and device logging behaves normally.
If your project is built with a different configuration name for debugging, add the platform-specific value under that configuration instead.
3. Filter the console instead of disabling logs
If you would rather not change the scheme, use the filter field at the bottom right of the Xcode debug area and type part of your own message or a prefix you control. This hides nothing at the source, but it makes your output easy to find.
For your own messages, a consistent prefix or the Logger API (iOS 14+) with your own subsystem and category makes filtering reliable:
import OSLog
let log = Logger(subsystem: "com.example.myapp", category: "network")
log.info("Request started")
You can then filter by your subsystem in Xcode’s console or in Console.app.
Things to know
- Disabling
OS_ACTIVITY_MODEhides real system messages too, so if you are debugging a framework problem, turn it back on. - Environment variables set in a scheme affect only runs started from Xcode, not the installed app.
- Never rely on this variable for production behavior. It is a debug-time convenience only.
How to prevent it
- Use the simulator-only setup (fix 2) so you do not lose
NSLogoutput on devices. - Commit the shared scheme to source control so the whole team gets the same console behavior.
- Use
Loggerwith your own subsystem and category so your logs are easy to filter. - Re-enable the variable (untick it in the scheme) when diagnosing a system-level problem.
FAQ
Are these Xcode console messages errors?
No. Lines like subsystem: com.apple.UIKit, category: HIDEvents are informational output from system frameworks configuring logging. They do not indicate a bug in your app.
Why did my logs disappear on a real device?
Setting OS_ACTIVITY_MODE to disable for device runs can suppress NSLog output in the Xcode console. Use the ${DEBUG_ACTIVITY_MODE} approach so the value applies only to the simulator.
Does this setting affect my App Store build?
No. Scheme environment variables apply only when the app is launched from Xcode. They are not part of the shipped app.
Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.
