I have a log function:
#define LOGERROR(err) if(err) { \
LOGTRACE(@"[NSError] %s (%d): (%d:%@) Reason: %@", \
__PRETTY_FUNCTION__, \
__LINE__, \
err.code, \
err.domain, \
err.localizedDescription) \
}
When I call it with
LOGERROR(playerItem.error);
I get a warning: "NSInteger should not be used as a format argument, add an explicit cast to long".
Xcode's autofix inserts %ld before LOGERROR, which is wrong.
I think this warning comes from the use of __LINE__
, which according to https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html returns an int.
How can I remove the warning from this call?