我正在尝试创建一个自定义NSLog()
方法,DNSLog()
它NSLog
仅在调试变量为真时执行。
-(void)DNSLog:(NSString *)formatString, ...
{
if(debug){
va_list args;
va_start(args, formatString);
NSLog([[NSString alloc] initWithFormat:formatString arguments:args]);
va_end(args);
}
}
但是当我尝试使用它调用它时
DNSLog(@"Hello %d",x);
我收到一个编译错误:
Undefined symbols for architecture i386:
"_DZNSLog", referenced from:
-[RestaurantInfoViewController viewDidLoad] in RestaurantInfoViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已将此作为参考: http: //www.cocoawithlove.com/2009/05/variable-argument-lists-in-cocoa.html
我哪里错了?