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 的条款和条件发布的。