BugReportKit 0.1.11

BugReportKit 0.1.11

测试已测试
语言语言 OBJ-CObjective C
许可证 MIT
发布最后发布2015年10月

Rahul Jiresal维护。




关于

我们一直希望错误报告能够更简单。用户不应该需要跳过繁琐的步骤来告诉我们应用中发生了什么。BugReportKit是一次让错误报告变得简单的尝试。

一旦BugReportKit集成到您的应用中(请查看下面的代码示例),用户只需截取屏幕截图,在屏幕上的错误位置进行涂抹以指示错误,写一个简短的描述,然后发送即可!BugReportKit目前允许您自动将错误报告发送为GitHub Issues,JIRA Issues,Gitlab Issues或电子邮件。

这是由BugReportKit提交的issue示例

这里是一个GIF视频--

BugReportKit GIF

要运行示例项目,首先克隆存储库,然后从Example目录运行pod install

安装

BugReportKit通过CocoaPods可用。要安装它,只需将以下行添加到Podfile中。

pod "BugReportKit"

使用方法

GitHub和JIRA的API不支持通过它们的API上传图片。因此,我们需要一个公共位置来上传图片,并将链接包含到GitHub/JIRA issues中。BugReportKit包括AWS S3上传器,但您可以轻松实现自己的上传器,只需实现BRKImageUploader协议即可。

将错误报告发送到GitHub Issues

您需要为GitHub添加额外的子Pod。

pod "BugReportKit"
pod "BugReportKit/GithubReporter"

然后,在您的AppDelegate中,

#import <BRK.h>
#import <BugReportKit/BRKGithubReporter.h>
#import <BugReportKit/BRKS3ImageUploader.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    BRKS3ImageUploader* uploader = [[BRKS3ImageUploader alloc] initWithS3AccessKey:S3_ACCESSKEY
                                                                         secretKey:S3_SECRETKEY
                                                                        bucketName:S3_BUCKET];
    BRKGithubReporter* reporter = [[BRKGithubReporter alloc] initWithGithubUsername:GITHUB_USERNAME
                                                                           password:GITHUB_PASSWORD
                                                                         repository:GITHUB_REPO
                                                                              owner:GITHUB_OWNER
                                                                      imageUploader:uploader];

    [BugReportKit initializeWithReporter:reporter delegate:self];
    [BugReportKit setUniqueUserIdentifier:@"[email protected]"]; // (optional) It can be anything that uniquely identifies your user in case you want to contact them

    return YES;
}

将错误报告发送到JIRA Issues

您需要为GitHub添加额外的子Pod。

pod "BugReportKit"
pod "BugReportKit/JIRAReporter"

然后,在您的AppDelegate中,

#import <BRK.h>
#import <BugreportKit/BRKJIRAReporter.h>
#import <BugReportKit/BRKS3ImageUploader.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    BRKS3ImageUploader* uploader = [[BRKS3ImageUploader alloc] initWithS3AccessKey:S3_ACCESSKEY
                                                                         secretKey:S3_SECRETKEY
                                                                        bucketName:S3_BUCKET];
    BRKJIRAReporter* reporter = [[BRKJIRAReporter alloc] initWithJIRABaseURL:JIRA_URL
                                                                    username:JIRA_USERNAME
                                                                    password:JIRA_PASSWORD
                                                                  projectKey:JIRA_PROJECTKEY
                                                               imageUploader:uploader];

    [BugReportKit initializeWithReporter:reporter delegate:self];
    [BugReportKit setUniqueUserIdentifier:@"[email protected]"]; // (optional) It can be anything that uniquely identifies your user in case you want to contact them

    return YES;
}

将错误报告发送到Gitlab Issues

您需要为Gitlab添加额外的子Pod。

pod "BugReportKit"
pod "BugReportKit/GitlabReporter"

然后,在您的AppDelegate中,

#import <BRK.h>
#import <BugReportKit/BRKGitlabReporter.h>
#import <BugReportKit/BRKS3ImageUploader.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    BRKS3ImageUploader* uploader = [[BRKS3ImageUploader alloc] initWithS3AccessKey:S3_ACCESSKEY
                                                                         secretKey:S3_SECRETKEY
                                                                        bucketName:S3_BUCKET];
    BRKGitlabReporter* reporter = [[BRKGitlabReporter alloc] initWithGitlabUsername:GITLAB_USERNAME
                                                                           password:GITLAB_PASSWORD
                                                                         repository:GITLAB_REPO
                                                                              owner:GITLAB_OWNER
                                                                      imageUploader:uploader];

    [BugReportKit initializeWithReporter:reporter delegate:self];
    [BugReportKit setUniqueUserIdentifier:@"[email protected]"]; // (optional) It can be anything that uniquely identifies your user in case you want to contact them

    return YES;
}

通过电子邮件发送错误报告

注意:Email子Pod使用的依赖项有一个巨大的静态库(100+ MB)。除非您没有其他选择,否则我不建议使用电子邮件报告错误。

您需要为GitHub添加额外的子Pod。

pod "BugReportKit"
pod "BugReportKit/EmailReporter"

然后,在您的AppDelegate中,

#import <BRK.h>
#import <BugreportKit/BRKEmailReporter.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    BRKEmailReporter* reporter = [[BRKEmailReporter alloc] initWithHostname:EMAIL_HOSTNAME
                                                                       port:EMAIL_HOSTPORT
                                                                   username:EMAIL_USERNAME
                                                                   password:EMAIL_PASSWORD
                                                             connectionType:BRKEmailConnectionTypeClear
                                                                  toAddress:EMAIL_TO];

    [BugReportKit setUniqueUserIdentifier:@"[email protected]"]; // (optional) It can be anything that uniquely identifies your user in case you want to contact them

    return YES;
}

您还可以添加BugReportKitDelegate方法

#pragma mark - BugReportKitDelegate

- (void)bugReportSentSuccessfully {
    NSLog(@"Bug Report Was Sent Successfully");
}

- (void)bugReportFailedToSend {
    NSLog(@"Bug Report Failed");
}

- (void)bugReportCancelled {
    NSLog(@"Bug Report Was Cancelled");
}

作者

如果您喜欢这个库,或者有任何建议,请告诉我。我计划定期维护这个库。欢迎提交任何拉取请求!

Rahul Jiresal, [email protected]网站Twitter

喜欢这个项目吗?它帮您节省了一些时间吗?想要请我喝杯啤酒表示感谢?donation

我可以提供合同开发服务!欢迎雇佣我!

许可协议

BugReportKit遵循MIT许可协议。有关更多信息,请参阅LICENSE文件。