Reputation: 1441
I have defined the following macro:
#define DSLog(x,...) [[DSLogger sharedInstance] Log:(x, __VA_ARGS__)]
@interface DSLogger : NSObject
+ (instancetype)sharedInstance;
- (void)Log:(NSString *)messageToLog,...;
- (NSArray *)errorLogArray;
@end
However I get a lot of "Expected expression" errors when I use it:
DSLog(@"setting dhcp to %ld", (long)dhcp);
Expression result unused & Implicit conversion of long to NSString is disallowed with ARC
Any ideas why this is happening and how to fix it?
Upvotes: 0
Views: 66
Reputation: 31016
It looks as if the parentheses that wrap the Log
parameter in the macro are causing confusion.
Try:
#define DSLog(x,...) [[DSLogger sharedInstance] Log:x, __VA_ARGS__]
Upvotes: 3