デバッグ変数が true の場合にのみ実行されるカスタム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
どこが間違っていますか?