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
相關文章
相關標籤/搜索