LLDebugTool是一款針對開發(fā)者和測試者的調(diào)試工具,它可以幫助你在非Xcode的情況下,進(jìn)行數(shù)據(jù)分析和操作。
為您的下一個(gè)項(xiàng)目選擇LLDebugTool,或者遷移到您現(xiàn)有的項(xiàng)目中——您會為此感到驚喜!
最近更新 (1.2.0)
支持組件化。
LLDebugTool
現(xiàn)在已經(jīng)支持組件化了?,F(xiàn)在你可以集成某一個(gè)或者多個(gè)模塊到你自己的Debug 工具里。你可以直接使用每個(gè)模塊內(nèi)包含的視圖控制器,或者只調(diào)用Function
文件夾下的功能,然后自己搭建UI。
如何使用組件化,具體請看Wiki使用組件化或者添加 LLDebugTool 到你的項(xiàng)目中。
更多的修改內(nèi)容可以查看Version 1.2.0 Project。
新增
- 增加
LLRoute
,用于解決組件間的相互引用。當(dāng)相關(guān)組件存在時(shí),LLRoute
會調(diào)用相關(guān)的方法,否則什么都不會做。
更新
更新文件夾目錄?,F(xiàn)在整個(gè)項(xiàng)目是根據(jù)組件來分類的,在每個(gè)組件文件夾下,又分為
Function
和UserInterface
。修改組件間的相互引用的文件,改為由Route處理。
更新了
NSURLSessionConfiguration.m
,hook了protocolClasses
這個(gè)方法。
添加 LLDebugTool 到你的項(xiàng)目中
CocoaPods
CocoaPods 是集成LLDebugTool
的首選方式。
Objective - C
- 添加
pod 'LLDebugTool' , '~> 1.0.0'
到你的Podfile里。如果只想在Debug模式下使用,則添加pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']
到你的Podfile里,詳細(xì)的配置方式可以查看Wiki/如何僅在Debug環(huán)境中使用。如果你想要指定某個(gè)版本,可以類似這樣使用pod 'LLDebugTool' , '1.1.7' ,:configurations => ['Debug']
。- 終端輸入
pod install
來進(jìn)行集成。搜索不到LLDebugTool
或者搜不到最新版本時(shí),可先運(yùn)行pod repo update
,再執(zhí)行pod install
。- 在你需要使用LLDebugTool的文件里添加
#import "LLDebug.h"
,或者直接在pch文件中添加#import "LLDebug.h"
。
Swift
- 添加
pod 'LLDebugToolSwift' , '~> 1.0.0'
到你的Podfile里。如果只想在Debug模式下使用,則添加pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']
到你的Podfile里,詳細(xì)的配置方式可以查看Wiki/如何僅在Debug環(huán)境中使用。如果你想要指定某個(gè)版本,可以類似這樣使用pod 'LLDebugToolSwift' , '1.1.7' ,:configurations => ['Debug']
。- 必須在Podfile中添加
use_frameworks!
。- 終端輸入
pod install
來進(jìn)行集成。搜索不到LLDebugToolSwift
或者搜不到最新版本時(shí),可先運(yùn)行pod repo update
,再執(zhí)行pod install
。- 在你需要使用LLDebugTool的文件里添加
import LLDebugToolSwift
。
Carthage
Carthage 是一個(gè)分散的依賴管理器,它構(gòu)建您的依賴并為您提供framework框架。
Objective - C
要使用Carthage將LLDebugTool集成到Xcode項(xiàng)目中,請?jiān)?code>Cartfile中指定它:
github "LLDebugTool"
運(yùn)行
carthage
來構(gòu)建框架,并將構(gòu)建的LLDebugTool.framework
拖到Xcode項(xiàng)目中。
Swift
要使用Carthage將LLDebugToolSwift集成到Xcode項(xiàng)目中,請?jiān)?code>Cartfile中指定它:
github "LLDebugToolSwift"
運(yùn)行
carthage
來構(gòu)建框架,并將構(gòu)建的LLDebugToolSwift.framework
拖到Xcode項(xiàng)目中。
源文件
您可以直接將名為LLDebugTool文件夾的源文件添加到項(xiàng)目中。
Objective - C
- 下載最新的代碼版本或?qū)⒋鎯熳鳛間it子模塊添加到您的git跟蹤項(xiàng)目中。
- 在Xcode中打開項(xiàng)目,然后拖拽名為“LLDebugTool”的源文件夾到你的項(xiàng)目中。當(dāng)提示Choose options for adding these files時(shí),務(wù)必勾選Copy items if needed這項(xiàng)。
- 集成FMDB到項(xiàng)目中,F(xiàn)MDB是一個(gè)圍繞SQLite的Objective-C包裝器開源庫。
- 在你需要使用LLDebugTool的文件里添加
#import "LLDebug.h"
,或者直接在pch文件中添加#import "LLDebug.h"
。
Swift
- 下載最新的Objective-C代碼版本或?qū)⒋鎯熳鳛間it子模塊添加到您的git跟蹤項(xiàng)目中。
- 下載最新的Swift擴(kuò)展代碼版本或?qū)⒋鎯熳鳛間it子模塊添加到您的git跟蹤項(xiàng)目中。
- 在Xcode中打開項(xiàng)目,然后拖拽名為“LLDebugTool”和“LLDebugToolSwift”的源文件夾到你的項(xiàng)目中。當(dāng)提示Choose options for adding these files時(shí),務(wù)必勾選Copy items if needed這項(xiàng)。
- 集成FMDB到項(xiàng)目中,F(xiàn)MDB是一個(gè)圍繞SQLite的Objective-C包裝器開源庫。
- 在你需要使用LLDebugTool的文件里添加
import LLDebugToolSwift
。
如何使用
啟動(dòng)
你需要在"application:(UIApplication * )application didFinishLaunchingWithOptions:(NSDictionary * )launchOptions"中啟動(dòng)LLDebugTool,否則你可能會丟掉某些信息。
如果你想自定義一些參數(shù),你需要在調(diào)用"startWorking"前配置這些參數(shù)。更詳細(xì)的配置信息請看LLConfig.h。
快速啟動(dòng)
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
}
使用自定義的配置啟動(dòng)
In Objective-C
#import "AppDelegate.h"
#import "LLDebug.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//####################### Color Style #######################//
// Uncomment one of the following lines to change the color configuration.
// [LLConfig sharedConfig].colorStyle = LLConfigColorStyleSystem;
// [[LLConfig sharedConfig] configBackgroundColor:[UIColor orangeColor] textColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault];
//####################### User Identity #######################//
// Use this line to tag user. More config please see "LLConfig.h".
[LLConfig sharedConfig].userIdentity = @"Miss L";
//####################### Window Style #######################//
// Uncomment one of the following lines to change the window style.
// [LLConfig sharedConfig].windowStyle = LLConfigWindowNetBar;
//####################### Features #######################//
// Uncomment this line to change the available features.
// [LLConfig sharedConfig].availables = LLConfigAvailableNoneAppInfo;
// ####################### Start LLDebugTool #######################//
// Use this line to start working.
[[LLDebugTool sharedTool] startWorking];
return YES;
}
In Swift
import LLDebugToolSwift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//####################### Color Style #######################//
// Uncomment one of the following lines to change the color configuration.
// LLConfig.shared().colorStyle = .system
// LLConfig.shared().configBackgroundColor(.orange, textColor: .white, statusBarStyle: .default)
//####################### User Identity #######################//
// Use this line to tag user. More config please see "LLConfig.h".
LLConfig.shared().userIdentity = "Miss L";
//####################### Window Style #######################//
// Uncomment one of the following lines to change the window style.
// LLConfig.shared().windowStyle = .netBar
//####################### Features #######################//
// Uncomment this line to change the available features.
// LLConfig.shared().availables = .noneAppInfo
// ####################### Start LLDebugTool #######################//
// Use this line to start working.
LLDebugTool.shared().startWorking()
return true
}
日志
打印和保存一個(gè)日志。 更多的log宏信息查看LLLogHelper.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.")
}
網(wǎng)絡(luò)請求
你不需要做任何操作,只需要調(diào)用了"startWorking"就可以監(jiān)控大部分的網(wǎng)絡(luò)請求,包括使用NSURLSession,NSURLConnection和AFNetworking。如果你發(fā)現(xiàn)某些情況下無法監(jiān)控網(wǎng)絡(luò)請求,請打開一個(gè)issue來告訴我。
崩潰
你不需要做任何操作,只需要調(diào)用"startWorking"就可以截獲崩潰,保存崩潰信息、原因和堆棧信息,并且也會同時(shí)保存當(dāng)次網(wǎng)絡(luò)請求和日志信息。
App信息
LLDebugTool會監(jiān)控app的CPU,內(nèi)存和FPS。你可以更便捷的查看app的各種信息。
沙盒
LLDebugTool提供了一個(gè)快捷的方式來查看和操作沙盒文件,你可以更輕松的刪除沙盒中的文件/文件夾,或者通過airdrop來分享文件/文件夾。只要是apple支持的文件格式,你可以直接通過LLDebugTool來預(yù)覽。
更多使用
- 你可以通過查看Wiki,獲得更多幫助。
- 你可以下載并運(yùn)行LLDebugToolDemo或LLDebugToolSwiftDemo來發(fā)現(xiàn)LLDebugTool的更多使用方式。Demo是在XCode9.3,ios 11.3,cocoapods 1.5.0下運(yùn)行的,如果有任何版本兼容問題,請告訴我。
要求
LLDebugTool在支持ios8+,并且需要使用ARC模式。使用到的框架已經(jīng)包含在大多數(shù)Xcode模板中:
UIKit
Foundation
SystemConfiguration
Photos
malloc
mach-o
mach
QuickLook
objc
sys
結(jié)構(gòu)
LLDebug.h 公用頭文件.
-
LLConfig 配置文件。
用于自定義顏色、大小、標(biāo)識和其他信息。如果您想要配置任何東西,您需要關(guān)注這個(gè)文件。
-
LLDebugTool 工具文件。
用于啟動(dòng)和停止LLDebugTool,你需要看一下"LLDebugTool.h"這個(gè)文件。
-
Helper 輔助文件。
如果你對功能的實(shí)現(xiàn)原理不感興趣,那么可以忽略這個(gè)文件夾。
- LLAppHelper 用于監(jiān)視應(yīng)用程序的各種屬性。
- LLCrashHelper 用于當(dāng)App發(fā)生崩潰時(shí),收集崩潰信息。
- LLLogHelper 快速打印和保存日志。
- LLNetworkHelper 用于監(jiān)視網(wǎng)絡(luò)請求。
- LLSandboxHelper Sandbox Helper。用于查看和操作沙盒文件。
- LLStorageManager Storage Helper。用于數(shù)據(jù)存儲和讀取。
-
UserInterface UI文件。
如果你想要修改、查看或者學(xué)習(xí)UI方面的東西,你可以查看一下這個(gè)文件夾。
- Base 父類文件
- Categories 類擴(kuò)展
- Others 不通用的控件
- Resources 圖片資源
- Sections 視圖控制器
- Tool 工具
聯(lián)系
- 如果你需要幫助,打開一個(gè)issue。
- 如果你想問一個(gè)普遍的問題,打開一個(gè)issue。
- 如果你發(fā)現(xiàn)了一個(gè)bug,并能提供可靠的復(fù)制步驟,打開一個(gè)issue。
- 如果你有一個(gè)功能請求,打開一個(gè)issue。
- 如果你發(fā)現(xiàn)有什么不對或不喜歡的地方,就打開一個(gè)issue。
- 如果你有一些好主意或者一些需求,請發(fā)郵件(llworkinggroup@qq.com)給我。
- 如果你想貢獻(xiàn),提交一個(gè)pull request。
聯(lián)系
- 可以在簡書中發(fā)私信給我。
- 可以發(fā)郵件到llworkinggroup@qq.com
更新日志
可以在 CHANGELOG 中找到每個(gè)LLDebugTool版本的簡要總結(jié)。