Git Product home page Git Product logo

pstcollectionview's Introduction

#Objective-C Debug 学习

子文的博客

苹果xcode图标 只会写代码的程序员不是好程序员,程序员是一个从制造bug到解决bug的死循环中不断成长,

NSLog(@"Founction:%s\n Pretty founction:%s\n Line:%d\n File:%s\n Object:%@",__func__,__PRETTY_FUNCTION__, __LINE__, __FILE__, self );

输出结果

2015-03-11 15:33:20.316 ssss[4080:184167] 
 Founction:-[AppDelegate application:didFinishLaunchingWithOptions:]
 Pretty founction:-[AppDelegate application:didFinishLaunchingWithOptions:]
 Line:19
 File:/Users/ziwen/Desktop/artical/ssss/ssss/AppDelegate.m
 Object:<AppDelegate: 0x7f8beb416980>

上述结果原因是 func, PRETTY_FUNCTION, LINE, __FILE__等都是系统预留的定义词,简单易用。

同时还有一些系统方法可以从CFString 转换为NSString。包括且不限于selector,class,protocol等,参考下面的代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSLog(@"Current selector: %@", NSStringFromSelector(_cmd));
NSLog(@"Filename: %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent]);
NSLog(@"object class:%@",NSStringFromClass([self class]));
return YES;
}

输出结果如下:

2015-03-11 15:38:10.034 ssss[4104:186832] Current selector: application:didFinishLaunchingWithOptions:
2015-03-11 15:38:10.034 ssss[4104:186832] Filename: AppDelegate.m
2015-03-11 15:38:10.034 ssss[4104:186832] object class:AppDelegate

通过拿到字符串做一些其他操作,是不是很hi,duang,duang。

pstcollectionview's People

Contributors

343max avatar aburgel avatar advantis avatar alexanderedge avatar azone avatar beaugbolle avatar connorhu avatar cysp avatar emeitch avatar gavrix avatar inamiy avatar jensdee avatar jlnr avatar joelcarranza avatar ksuther avatar lluuaapp avatar loganmoseley avatar lono175 avatar mattjgalloway avatar montreux avatar orta avatar pkclsoft avatar ptescher avatar sibljon avatar steipete avatar streeter avatar taiyangc avatar tibr avatar toco avatar tyrone-sudeium avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.