SRReport 是一个小型库,使测试人员能够轻松地报告错误。摇晃 iDevice 并发送当前视图的屏幕截图
QuartzCore
library
文件夹。包含 SRReporter.h
然后,复制此行以启动报告程序
用法
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[SRReporter reporter] startListener]; //this line starts the reporter
return YES;
}
配置
附加信息
SRReporter *reporter = [SRReporter reporter];
[reporter setDefaultEmailAddress:@"[email protected]"];
[reporter startListener];
这个块必须返回一个字符串,该字符串将被插入到 additionalInformation.log 文件中。
[reporter setCustomInformationBlock:^NSString *{
return [NSString stringWithFormat:@"Application: Sample Application, User: Jayztemplier, Device Name: %@", [[UIDevice currentDevice] name]];
}];
与后端一起使用
为了将报告发送到服务器,设置监听器如下
如果您后端受用户名和密码保护,您必须设置报告程序
SRReporter *reporter = [SRReporter reporter];
// Send data to a Server instead of displaying the mail composer
NSURL *url = [NSURL URLWithString:@"https://127.0.0.1:3000/reports.json"];
[reporter startListenerConnectedToBackendURL:url];
许可
[reporter setUsername:@"jayztemplier"];
[reporter setPassword:@"mypassword"];
CocoaPods 是一个由