Argument must be a static method or property of 'OSLogPrivacy'

I'm trying to get my head around the new APIs for Logger in iOS 14 with Xcode beta 2 to create a wrapper class for these apis.

I get this error Argument must be a static method or property of 'OSLogPrivacy' even though i'm using a static method.

Even this didn't work:

Would be great to have some explanation here. I feel it's more of a bug.

4 Likes

The logging APIs use special compiler features to evaluate the privacy level at compile time. As the diagnostic says, you must use a static (i.e., known at compile time) method or property of ‘OSLogPrivacy’; it can’t be a variable that’s evaluated at run time. The implication is that you can’t create your own wrapper for these APIs without using compiler-internal features.

It’s reasonable to file a bug to clarify the meaning of ‘static’ in this diagnostic message.

6 Likes