I'm trying to use OSSignposter to capture intervals in our app for use in Instruments. The sample code here works in a new project. I see the intervals, signpost icons, etc. However, this same code (integrated into a much bigger app) does not record or display ANY intervals.
I can get the config status on both apps' oslog configuration, and there's no difference.
sudo log config --status --subsystem **.*******.*******.signposttest
Mode for '**.*******.*******.signposttest' INFO PERSIST_DEFAULT
I've checked both workspaces and schemes. There is no difference between these projects. The only thing I can think of at this point is a build setting that could affect it. (I'm not using OS_ACTIVITY_MODE = disable
but have during the lifetime of this app).
Perhaps it's a provision profile issue? Entitlements? However, I've tried profiling in debug mode with debug provision profile and got the same results.
Not seeing any signpost activity is happening in immediate mode
and deferred mode
. I see events in the bottom pane in "List: Events" view. In the last n seconds mode
, there is no data, no lanes, and nothing on the timeline.
Here's the sample code. I tried in both projects.
import os.signpost
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var blackWindow: UIWindow?
var alertWindow: UIWindow?
static var originalAppDelegate: AppDelegate!
var signposter: OSSignposter
var signpostInterval: OSSignpostIntervalState?
override init() {
signposter = OSSignposter(subsystem: Bundle.main.bundleIdentifier ?? "unknown", category: "app")
signposter.emitEvent(#function)
}
func applicationWillResignActive(_ application: UIApplication) {
guard let interval = signpostInterval else {
assertionFailure("no interval")
return
}
print("backgrounding, ending active state")
signposter.endInterval("active", interval)
}
func applicationDidBecomeActive(_ application: UIApplication) {
signpostInterval = signposter.beginInterval("active")
}
}
Working
This is what I expect to see, signposts and intervals.
Not Working
However, this is the sample code run in the non-working project.
If I programmatically check if the OSSignposter is enabled, I get false
. I have no idea how this has been disabled externally, as I'm not explicitly disabling OSSignposter. I also do not see a way to programmatically enabled it.
signposter = OSSignposter(subsystem: Bundle.main.bundleIdentifier ?? "unknown", category: "app")
assert(signposter.isEnabled)
This always asserts. Any help would be very much appreciated.