I am having an issue with using Activity tracing with Swift. After doing some reading I found out that one way to use activity tracing in Swift is by writing an Objective-C wrapper which the Swift classes can call. However there seems to be a problem/limitation with this approach. That is,
if we write a wrapper with a method say as follows
- (void)logTrace:(NSString *) eventName {
os_trace(“%@“, eventName); // This will not work
}
The above code will not work since the documentation says that we cannot use format specifiers except %d inside os_trace(“”). This will mean that we will have to write separate methods for each event being traced like the following:
- (void)logConfigureLoginButtonPressed {
os_trace(“Configure Login Button Pressed"); // This will work
}
And call this method from the Swift class, this however doesn’t seem to be a very efficient way for tracing since the wraper will have a lot of methods as I add trace messages to my project.
Has anyone else faced ths issue. Is there a better workaround or any other way I can have Activity tracing in place so that if there are crashes I could get the trace messages along with the Crash Report similar to how I would get on using Activity tracing.