LLDebugTool是一款針對開發者和測試者的調試工具,它能夠幫助你在非Xcode的狀況下,進行數據分析和操做。ios
LLDebugToolSwift是針對LLDebugTool的Swift擴展,它提供了LLDebugTool的Swift接口,LLDebugToolSwift會和LLDebugTool同步更新。git
若是你的項目是一個Objective-C項目,你可使用LLDebugTool
,若是你的項目是一個Swift項目或者包含Swift文件,你可使用LLDebugToolSwift
。github
爲您的下一個項目選擇LLDebugTool,或者遷移到您現有的項目中——您會爲此感到驚喜!🎊🎊🎊網絡
視圖結構功能:如今你可使用Hierarchy
函數來查看屏幕上的每一個元素,而且能夠直觀地看到它們的frame和屬性,接下來會增長Hierarchy info
的實現。app
放大鏡功能:如今你可使用Magnifying
功能來查看每一個像素的內容或顏色,這讓你和UI設計師的溝通更方便。框架
更多的修改內容能夠查看 Version 1.3.0 Project。函數
Window
,更多信息能夠看到LLWindowManager.m
。LLDebugTool
如今不支持基於組件化,這是一個無用的特性,而且增長了模塊之間調用的難度。LLDebugTool
後來被維護相似一個應用程序,而不是多個功能模塊。檢查網絡請求或者查看某些事件的日誌信息,而沒必要非在XCode運行下運行。這在解決測試人員的問題上頗有用。工具
更輕鬆的篩選有用的信息。組件化
更輕鬆的處理偶發的問題。測試
更輕鬆的分析崩潰緣由。
更輕鬆的分享、預覽或刪除沙盒文件,這在開發階段很是有用。
更輕鬆的觀察App的CPU,內存,FPS等信息。
截屏、標註並分享。
更直觀的查看視圖結構。
更準確地肯定App裏的UI元素和顏色。
CocoaPods 是集成LLDebugTool
的首選方式。
- 添加
pod 'LLDebugTool' , '~> 1.0.0'
到你的Podfile裏。- 若是隻想在Debug模式下使用,則添加
pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']
到你的Podfile裏,詳細的配置方式能夠查看Wiki/如何僅在Debug環境中使用。若是你想要指定某個版本,能夠相似這樣使用pod 'LLDebugTool' , '1.3.0' ,:configurations => ['Debug']
。- 推薦的方式是採用多Target來處理,只在Debug Target中添加
pod 'LLDebugTool' , '~> 1.0.0'
,這樣作的好處既不污染Product環境的代碼,又能夠在Archive Debug環境的App時,將LLDebugTool
集成進去(若是採用:configurations => ['Debug']
的方式,只能經過XCode運行,不能夠Archive成App)。- 終端輸入
pod install
來進行集成。搜索不到LLDebugTool
或者搜不到最新版本時,可先運行pod repo update
,再執行pod install
。- 在你須要使用LLDebugTool的文件裏添加
#import "LLDebug.h"
,或者直接在pch文件中添加#import "LLDebug.h"
。
- 添加
pod 'LLDebugToolSwift' , '~> 1.0.0'
到你的Podfile裏。- 若是隻想在Debug模式下使用,則添加
pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']
到你的Podfile裏,詳細的配置方式能夠查看Wiki/如何僅在Debug環境中使用。若是你想要指定某個版本,能夠相似這樣使用pod 'LLDebugToolSwift' , '1.3.0' ,:configurations => ['Debug']
。- 推薦的方式是採用多Target來處理,只在Debug Target中添加
pod 'LLDebugToolSwift' , '~> 1.0.0'
,這樣作的好處既不污染Product環境的代碼,又能夠在Archive Debug環境的App時,將LLDebugToolSwift
集成進去(若是採用:configurations => ['Debug']
的方式,只能經過XCode運行,不能夠Archive成App)。- 必須在Podfile中添加
use_frameworks!
。- 終端輸入
pod install
來進行集成。搜索不到LLDebugToolSwift
或者搜不到最新版本時,可先運行pod repo update
,再執行pod install
。- 在你須要使用LLDebugTool的文件裏添加
import LLDebugToolSwift
。
Carthage 是一個分散的依賴管理器,它構建您的依賴併爲您提供framework框架。
要使用Carthage將LLDebugTool集成到Xcode項目中,請在
Cartfile
中指定它:
github "LLDebugTool"
運行
carthage
來構建框架,並將構建的LLDebugTool.framework
拖到Xcode項目中。
要使用Carthage將LLDebugToolSwift集成到Xcode項目中,請在
Cartfile
中指定它:
github "LLDebugToolSwift"
運行
carthage
來構建框架,並將構建的LLDebugToolSwift.framework
拖到Xcode項目中。
您能夠直接將名爲LLDebugTool文件夾的源文件添加到項目中。
- 下載最新的Objective-C代碼版本或將存儲庫做爲git子模塊添加到您的git跟蹤項目中。
- 下載最新的Swift擴展代碼版本或將存儲庫做爲git子模塊添加到您的git跟蹤項目中。
- 在Xcode中打開項目,而後拖拽名爲「LLDebugTool」和「LLDebugToolSwift」的源文件夾到你的項目中。當提示Choose options for adding these files時,務必勾選Copy items if needed這項。
- 集成FMDB到項目中,FMDB是一個圍繞SQLite的Objective-C包裝器開源庫。
- 在你須要使用LLDebugTool的文件裏添加
import LLDebugToolSwift
。
你須要在"application:(UIApplication * )application didFinishLaunchingWithOptions:(NSDictionary * )launchOptions"中啓動LLDebugTool,不然你可能會丟掉某些信息。
若是你想自定義一些參數,你須要在調用"startWorking"前配置這些參數。更詳細的配置信息請看LLConfig.h。
快速啓動
In Objective-C
#import "AppDelegate.h"
#import "LLDebug.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// The default color configuration is green background and white text color.
// Start working.
[[LLDebugTool sharedTool] startWorking];
// Write your project code here.
return YES;
}
複製代碼
In Swift
import LLDebugToolSwift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// ####################### Start LLDebugTool #######################//
// Use this line to start working.
LLDebugTool.shared().startWorking()
// Write your project code here.
return true
}
複製代碼
使用自定義的配置啓動
In Objective-C
#import "AppDelegate.h"
#import "LLDebug.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Start working with config.
[[LLDebugTool sharedTool] startWorkingWithConfigBlock:^(LLConfig * _Nonnull config) {
//####################### Color Style #######################//
// Uncomment one of the following lines to change the color configuration.
// config.colorStyle = LLConfigColorStyleSystem;
// [config configBackgroundColor:[UIColor orangeColor] primaryColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault];
//####################### User Identity #######################//
// Use this line to tag user. More config please see "LLConfig.h".
config.userIdentity = @"Miss L";
//####################### Window Style #######################//
// Uncomment one of the following lines to change the window style.
// config.entryWindowStyle = LLConfigEntryWindowStyleNetBar;
}];
return YES;
}
複製代碼
In Swift
import LLDebugToolSwift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Start working with config.
LLDebugTool.shared().startWorking { (config) in
//####################### Color Style #######################//
// Uncomment one of the following lines to change the color configuration.
// config.colorStyle = .system
// config.configBackgroundColor(.orange, textColor: .white, statusBarStyle: .default)
//####################### User Identity #######################//
// Use this line to tag user. More config please see "LLConfig.h".
config.userIdentity = "Miss L";
//####################### Window Style #######################//
// Uncomment one of the following lines to change the window style.
// config.windowStyle = .netBar
//####################### Features #######################//
// Uncomment this line to change the available features.
// config.availables = .noneAppInfo
}
return true
}
複製代碼
你不須要作任何操做,只須要調用了"startWorking"就能夠監控大部分的網絡請求,包括使用NSURLSession,NSURLConnection和AFNetworking。若是你發現某些狀況下沒法監控網絡請求,請打開一個issue來告訴我。
打印和保存一個日誌。 更多的log宏信息查看LLDebugToolMacros.h。
保存日誌
In Objective-C
#import "LLDebug.h"
- (void)testNormalLog {
// Insert an LLog where you want to print.
LLog(@"Message you want to save or print.");
}
複製代碼
In Swift
import LLDebugToolSwift
func testNormalLog() {
// Insert an LLog where you want to print.
LLog.log(message: "Message you want to save or print.")
}
複製代碼
Save Log with event and level
In Objective-C
#import "LLDebug.h"
- (void)testEventErrorLog {
// Insert an LLog_Error_Event where you want to print an event and level log.
LLog_Error_Event(@"The event that you want to mark. such as bugA, taskB or processC.",@"Message you want to save or print.");
}
複製代碼
In Swift
import LLDebugToolSwift
func testEventErrorLog() {
// Insert an LLog_Error_Event where you want to print an event and level log.
LLog.errorLog(message: "Message you want to save or print.", event: "The event that you want to mark. such as bugA, taskB or processC.")
}
複製代碼
你不須要作任何操做,只須要調用"startWorking"就能夠截獲崩潰,保存崩潰信息、緣由和堆棧信息,而且也會同時保存當次網絡請求和日誌信息。
LLDebugTool會監控app的CPU,內存和FPS。你能夠更便捷的查看app的各類信息。
LLDebugTool提供了一個快捷的方式來查看和操做沙盒文件,你能夠更輕鬆的刪除沙盒中的文件/文件夾,或者經過airdrop來分享文件/文件夾。只要是apple支持的文件格式,你能夠直接經過LLDebugTool來預覽。
LLDebugTool提供了一個截屏功能,而且能夠進行簡單的繪畫和標註,用於測試或者美工調試App時方便記錄。
LLDebugTool提供了一個視圖結構工具,用於在非Debug模式下查看元素的屬性和信息。
LLDebugTool提供了一個放大鏡的工具,用於放大局部UI和查看指定位置的顏色值。
LLDebugTool在支持ios8+,而且須要使用ARC模式。使用到的框架已經包含在大多數Xcode模板中:
UIKit
Foundation
SystemConfiguration
Photos
QuickLook
CoreTelephony
LLDebug.h
公用頭文件。全局引用此文件便可。
DebugTool
LLDebugTool.h
用於啓動和中止LLDebugTool,你須要看一下這個文件。
LLConfig.h
用於自定義顏色、大小、標識和其餘信息。若是您想要配置任何東西,您須要關注這個文件。
LLDebugToolMacros.h
快捷的宏定義文件。
Component
Network
用於監視網絡請求。Log
快速打印和保存日誌。Crash
用於當App發生崩潰時,收集崩潰信息。AppInfo
用於監視應用程序的各類屬性。Sandbox
用於查看和操做沙盒文件。Screenshot
用於處理和展現截屏事件。Hierarchy
用於處理和展現視圖結構。Magnifier
用於放大鏡功能。能夠在 CHANGELOG 中找到每一個LLDebugTool版本的簡要總結。
這段代碼是根據 MIT license 的條款和條件發佈的。