1

我经常这样做

    CLog(@"someNew.Title %@", someNew.Title); //Working
    CLog (@"_currentBusiness.managedObjectContext %@",_currentBusiness.managedObjectContext);
    CLog (@"someNew.managedObjectContext %@",someNew.managedObjectContext);
    CLog (@"[ThreadClass managedObjectContext] %@",[ThreadClass managedObjectContext]);
    CLog (@"UIAppDelegate.managedObjectContext %@",UIAppDelegate.managedObjectContext);

基本上我会

CLog (@"VariableName %@", VariableName)

有没有办法把它变成一个宏?

4

1 回答 1

3

这应该工作 - 像这样定义宏:

#define CLOG(x) CLog(@#x " %@", x)

然后像这样调用它:

CLOG(someNew.Title);
于 2012-05-21T09:55:49.937 回答