自定义NSLog Use of undeclared identifier 'format'; did you mean 'normal'

自定义NSLog方便前期debug调试

#if DEBUG

#define NSLog(FORMAT, ...) fprintf(stderr,"\nfunction:%s line:%d\n%s\n", __FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);

#else

#define NSLog(FORMAT, ...) nil

#endif


//带有弹出警告窗的NSLog

#ifdef DEBUG

#  define CPLog(fmt, ...)  { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__]  delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; }

#else

#  define CPLog(...)

#endif

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • ifndef MacroDefinition_h define MacroDefinition_h //-----...
    灰客阅读 368评论 0 0
  • iOS开发过程中,使用的一些常用宏定义 字符串是否为空#define kStringIsEmpty(str) ([...
    goyohol阅读 5,397评论 30 85
  • 本文大部分是摘取新风做浪博友的宏定义 和 大神sunnyxx ,后续会持续更新。 #ifndef MacroDef...
    潘老6阅读 852评论 0 5
  • github:https://github.com/koknine (终于改成以前的了) iOS开发当中,有很多用...
    imageURL阅读 562评论 0 4
  • 闺女还不到五岁,得病了因年龄有点小,我基本只采取传统疗法,因此免不了吃中药,这东西大人都难以下咽,何况是小孩,而是...
    黄健歌阅读 856评论 0 0