首页 > 移动平台 > 详细

IOS用NSLog做 debug调试

时间:2014-11-04 13:00:01      阅读:243      评论:0      收藏:0      [点我收藏+]
-(id) initWithPlayer:(VVPlayer *)aPlayer seatsNum:(int)seatsNum
{ 

    if (self = [super init])
    {
      NSLog(@”\n Function: %s\n Pretty function: %s\n Line: %d\n File: %s\n Object: %@”,__func__, __PRETTY_FUNCTION__, __LINE__, __FILE__, aPlayer);  
    }
…
}

 

__func__ __PRETTY_FUNCTION__ __LINE__ __FILE__都是系统预留的定义词,简单易用

另外还有一些Core Foundation的方法可以从CFString的层级拿到一些有用的字符串,包括且不限于selector、class、protocol等

-(id) initWithPlayer:(VVPlayer *)aPlayer seatsNum:(int)seatsNum
{ if (self = [super init])
{
NSLog(@”Current selector: %@”, NSStringFromSelector(_cmd));  
NSLog(@”Object class: %@”, NSStringFromClass([self class]));  
NSLog(@”Filename: %@”, [[NSString stringWithUTF8String:__FILE__] lastPathComponent]);  
}
…
}

 

IOS用NSLog做 debug调试

原文:http://www.cnblogs.com/luseike/p/4073268.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!