GYMonitor是一个用于监控iOS app性能状况的代码库,目前包括FPS监控,当发现FPS过低时会自动生成堆栈,便于在开发过程中发现卡顿问题。
GYMonitor
整个文件夹拖动到现有的Xcode工程中。需要注意的是GYMonitor
中包含CrashReporter.framework
这个库。#import "GYMonitor.h"
dsymInfo
文件夹复制到工程文件的同一目录,然后在工程文件中的Build Phases
最后添加一个Run Script
,脚本内容为python ${PROJECT_DIR}/dsymInfo/backup.py
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// normal code...
[self startMonitor];
return YES;
}
- (void)startMonitor {
[GYMonitor sharedInstance].monitorFPS = YES;
[GYMonitor sharedInstance].showDebugView = YES;
[[GYMonitor sharedInstance] startMonitor];
}
- (void)stopMonitor {
[GYMonitor sharedInstance].monitorFPS = NO;
[GYMonitor sharedInstance].showDebugView = NO;
[[GYMonitor sharedInstance] startMonitor];
}