码迷,mamicode.com
首页 > 移动开发 > 详细

IOS用NSLog做 debug调试

时间:2014-11-04 13:00:39      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:blog   io   os   sp   div   on   log   cti   bs   

-(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调试

标签:blog   io   os   sp   div   on   log   cti   bs   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!