iOS中的程序调试

1、在开发中如何调试程序?使用过哪些调试工具?html

》调用堆栈: 从下到上执行。web

》视图层次结构—查看视图遮挡以及自动布局错误app

》断点和    条件断点工具

》lldb 布局

》instrument: Time Profile / Core Animation / 内存泄漏 网站


2、程序上线后,如何收集错误信息?spa

    收集错误--腾讯的bugly调试

   官方网站 http://bugly.qq.com/code

操做步骤

  • Podorm

    pod 'Bugly'
  • 登陆官方网站,注册 App

  • 在 application:didFinishLaunchingWithOptions:添加如下代码

      [[CrashReporter sharedInstance] setUserId:@"UserID"];
     [[CrashReporter sharedInstance] installWithAppId:@"AppID"];
  • 参考视频地址:http://www.jikexueyuan.com/course/534.html

3、NSLog

  建立一个pch文件---->配置pch文件。在pch文件中拷贝下面内容便可

#ifdef __OBJC__

#ifdef DEBUG#define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define NSLog(...)
#endif

#endif
相关文章
相关标签/搜索