LLDebugTool - 便捷的IOS除錯工具(支援Swift)
LLDebugTool 是一款針對開發者和測試者的除錯工具,它可以幫助你在非Xcode的情況下,進行資料分析和操作。
Swift" rel="nofollow,noindex">LLDebugToolSwift 是針對 LLDebugTool 的Swift擴充套件,它提供了LLDebugTool的Swift介面,LLDebugToolSwift會和LLDebugTool同步更新。
如果你的專案是一個Objective-C專案,你可以使用 LLDebugTool
,如果你的額專案是一個Swift專案或者包含Swift檔案,你可以使用 LLDebugToolSwift
。
為您的下一個專案選擇LLDebugTool,或者遷移到您現有的專案中——您會為此感到驚喜!
Gif
ScreenShots
最近更新 (1.1.7)
支援Swift,更多Swift的用法可以檢視 LLDebugToolSwift 。
LLDebugToolSwift
是一個 LLDebugTool
的swift元件,它提供了一個 LLog
的swift類,用於在swift中使用log。
更多的修改內容可以檢視 Version 1.1.7 Project 。
新增
- 增加
LLog.swift
,用於解決LLDebugToolMacros
無法在swift中使用。
更新
- 更新
LLCrashHelper
,現在LLDebugTool
可以正確的截獲signal資訊。
我能用LLDebugTool做什麼?
-
檢查網路請求或者檢視某些事件的日誌資訊,而不必非在XCode執行下執行。這在解決測試人員的問題上很有用。
-
更輕鬆的篩選有用的資訊。
-
更輕鬆的處理偶發的問題。
-
更輕鬆的分析崩潰原因。
-
更輕鬆的分享、預覽或刪除沙盒檔案,這在開發階段非常有用。
-
更輕鬆的觀察App的CPU,記憶體,FPS等資訊。
新增 LLDebugTool 到你的專案中
CocoaPods
CocoaPods 是整合 LLDebugTool
的首選方式。
Objective - C
- 新增
pod 'LLDebugTool' , '~> 1.0.0'
到你的Podfile裡。如果只想在Debug模式下使用,則新增pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']
到你的Podfile裡,詳細的配置方式可以檢視 Wiki/如何僅在Debug環境中使用 。如果你想要指定某個版本,可以類似這樣使用pod 'LLDebugTool' , '1.1.7' ,:configurations => ['Debug']
。 - 終端輸入
pod install
來進行整合。搜尋不到LLDebugTool
或者搜不到最新版本時,可先執行pod repo update
,再執行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裡,詳細的配置方式可以檢視 Wiki/如何僅在Debug環境中使用 。如果你想要指定某個版本,可以類似這樣使用pod 'LLDebugToolSwift' , '1.1.7' ,:configurations => ['Debug']
。 - 必須在Podfile中新增
use_frameworks!
。 - 終端輸入
pod install
來進行整合。搜尋不到LLDebugToolSwift
或者搜不到最新版本時,可先執行pod repo update
,再執行pod install
。 - 在你需要使用LLDebugTool的檔案裡新增
import LLDebugToolSwift
。
Carthage
Carthage 是一個分散的依賴管理器,它構建您的依賴併為您提供framework框架。
Objective - C
-
要使用Carthage將LLDebugTool整合到Xcode專案中,請在
Cartfile
中指定它:github "LLDebugTool"
-
執行
carthage
來構建框架,並將構建的LLDebugTool.framework
拖到Xcode專案中。
Swift
-
要使用Carthage將LLDebugToolSwift整合到Xcode專案中,請在
Cartfile
中指定它:github "LLDebugToolSwift"
-
執行
carthage
來構建框架,並將構建的LLDebugToolSwift.framework
拖到Xcode專案中。
原始檔
您可以直接將名為LLDebugTool資料夾的原始檔新增到專案中。
Objective - C
- 下載 最新的程式碼版本 或將儲存庫作為git子模組新增到您的git跟蹤專案中。
- 在Xcode中開啟專案,然後拖拽名為“LLDebugTool”的原始檔夾到你的專案中。當提示Choose options for adding these files時,務必勾選Copy items if needed這項。
- 整合 FMDB 到專案中,FMDB是一個圍繞SQLite的Objective-C包裝器開源庫。
- 在你需要使用LLDebugTool的檔案裡新增
#import "LLDebug.h"
,或者直接在pch檔案中新增#import "LLDebug.h"
。
Swift
- 下載 最新的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 { //####################### 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 } 複製程式碼
日誌
列印和儲存一個日誌。 更多的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.") } 複製程式碼
網路請求
你不需要做任何操作,只需要呼叫了"startWorking"就可以監控大部分的網路請求,包括使用NSURLSession,NSURLConnection和AFNetworking。如果你發現某些情況下無法監控網路請求,請開啟一個issue來告訴我。
崩潰
你不需要做任何操作,只需要呼叫"startWorking"就可以截獲崩潰,儲存崩潰資訊、原因和堆疊資訊,並且也會同時儲存當次網路請求和日誌資訊。
App資訊
LLDebugTool會監控app的CPU,記憶體和FPS。你可以更便捷的檢視app的各種資訊。
沙盒
LLDebugTool提供了一個快捷的方式來檢視和操作沙盒檔案,你可以更輕鬆的刪除沙盒中的檔案/資料夾,或者通過airdrop來分享檔案/資料夾。只要是apple支援的檔案格式,你可以直接通過LLDebugTool來預覽。
更多使用
- 你可以通過檢視 Wiki ,獲得更多幫助。
- 你可以下載並執行 LLDebugToolDemo 或 LLDebugToolSwiftDemo 來發現LLDebugTool的更多使用方式。Demo是在XCode9.3,ios 11.3,cocoapods 1.5.0下執行的,如果有任何版本相容問題,請告訴我。
要求
LLDebugTool在支援ios8+,並且需要使用ARC模式。使用到的框架已經包含在大多數Xcode模板中:
-
Foundation
-
SystemConfiguration
-
Photos
-
malloc
-
mach-o
-
mach
-
QuickLook
-
objc
-
sys
結構
-
LLDebug.h
公用標頭檔案. -
LLConfig
配置檔案。用於自定義顏色、大小、標識和其他資訊。如果您想要配置任何東西,您需要關注這個檔案。
-
LLDebugTool
工具檔案。用於啟動和停止LLDebugTool,你需要看一下"LLDebugTool.h"這個檔案。
-
Helper
輔助檔案。如果你對功能的實現原理不感興趣,那麼可以忽略這個資料夾。
LLAppHelper LLCrashHelper LLLogHelper LLNetworkHelper LLSandboxHelper LLStorageManager
-
UserInterface
UI檔案。如果你想要修改、檢視或者學習UI方面的東西,你可以檢視一下這個資料夾。
Base Categories Others Resources Sections Tool
聯絡
- 如果你需要幫助 ,開啟一個issue。
- 如果你想問一個普遍的問題 ,開啟一個issue。
- 如果你發現了一個bug , 並能提供可靠的複製步驟 ,開啟一個issue。
- 如果你有一個功能請求 ,開啟一個issue。
- 如果你發現有什麼不對或不喜歡的地方 ,就開啟一個issue。
- 如果你有一些好主意或者一些需求 ,請發郵件( [email protected] )給我。
- 如果你想貢獻 ,提交一個pull request。