DebuggIt 1.1.0

DebuggIt 1.1.0

测试已测试
语言语言 Obj-CObjective C
许可证 Apache-2.0
版本最后发布2019年8月

MoodUp.team维护。



 
依赖
Alamofire~> 5.0.0-beta.7
SwiftyJSON~> 5.0.0
IQKeyboardManagerSwift~> 6.3.0
KMPlaceholderTextView~> 1.4.0
RNCryptor~> 5.1.0
ReachabilitySwift~> 4.3.1
 

DebuggIt 1.1.0

  • MoodUp.team

Version License Platform

debugg.it

https://debugg.it

目录

这个仓库是做什么的?

这是一个库,它提供了一个将 iOS 应用程序错误直接报告到 JIRA / GitHub/ BitBucket Issue Tracker 的工具。

示例

要运行示例项目,请打开 DebuggIt.xcworkspace,选择 DebuggItDemo 方案并构建它。

安装

debugg.it 通过 CocoaPods 提供。要安装它,请将以下内容添加到您的 Podfile 中并运行 pod install

use_modular_headers!
pod 'DebuggIt'

在项目中配置和初始化 debugg.it

在您的 AppDelegate 中导入 pod

import DebuggIt

为问题配置服务

将这些行之一(在方法开始时)添加以初始化 debugg.it 问题服务

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    ...
    // Override point for customization after application launch.
    DebuggIt.sharedInstance.initBitbucket(repoSlug: "repo-name", accountName: "repo-owner-username")
    // or Github
    DebuggIt.sharedInstance.initGithub(repoSlug: "repo-name", accountName: "repo-owner-username")
    // or JIRA
    DebuggIt.sharedInstance.initJira(host: "jira-host-url", projectKey: "project-key")
    ...
    return true
}

注意:如果您使用 JIRA 且您的宿主 不使用 SSL,则在使用初始化方法时使用额外的参数

DebuggIt.sharedInstance.initJira(host: "jira-host-url", projectKey: "project-key", usesHttps: false)

上传图像文件和(可选)音频文件的 API

debugg.it 需要一个 API,以便它可以发送图像文件和(可选)音频文件。有 3 种可用的配置

  • 默认 API

    此配置使用您的后端发送图像和音频文件。数据通过 POST 调用发送至指定端点,参数如下

    {
        "data": "base64String"
    }
    • DebuggIt.getInstance().initDefaultStorage(url: "baseUrl", imagePath: "imagePath", audioPath: "audioPath")
      • 其中
        • baseUrl 是您的后端的基准 URL(例如 https://url-to-backend.com
        • imagePath 是处理图像上传的端点(例如 /debuggit/uploadImage
        • audioPath 是处理音频上传的端点(例如 /debuggit/uploadAudio

  • 自定义 API

    这是默认API配置的扩展。不同之处在于您需要处理 uploadImage / uploadAudio 请求和响应。您负责与您的后端进行通信,但同时也拥有对其完全的控制权。

    • DebuggIt.sharedInstance.initCustomStorage(uploadImage: { (base64, delegate) in }, uploadAudio: { (base64, delegate) in })
      • 其中
        • uploadImage 是一个带有准备好的base64转换后的图片和响应委托的回调
          • delegate 是一个 ApiClientDelegate 对象,如果成功则应调用 .uploadSuccessClousure("url-to-image"),如果出现错误则调用 .errorClousure(code, message)
        • uploadImage 是一个带有准备好的base64转换后的图片和响应委托的回调
          • delegate 是一个 ApiClientDelegate 对象,如果成功则应调用 .uploadSuccessClousure("url-to-audio"),如果出现错误则调用 .errorClousure(code, message)

示例配置

  • 使用S3初始化BitBucket

DebuggIt.sharedInstance
        .initAWS(bucketName: "bucketName", regionType: .EUCentral1, identityPool: "identityPool")
        .initBitbucket(repoSlug: "repo-name", accountName: "repo-owner-username")
  • 使用默认API初始化GitHub

DebuggIt.sharedInstance
        .initDefaultStorage(url: "baseUrl", imagePath: "imagePath", audioPath: "audioPath")
        .initGithub(repoSlug: "repo-name", accountName: "repo-owner-username")
  • 使用自定义API初始化JIRA

DebuggIt.sharedInstance
        .initCustomStorage(uploadImage: { (base64, delegate) in
            // Handle API call to your backend and call uploadSuccessClousure on delegate with url
            // delegate.uploadSuccessClousure("url-to-image")

            // If something went wrong, call errorClousure on delegate
            // delegate.errorClousure(400, "Could not upload image")
        }, uploadAudio: { (base64, delegate) in
            // Handle API call to your backend and call uploadSuccessClousure on delegate with url
            // delegate.uploadSuccessClousure("url-to-audio")

            // If something went wrong, call errorClousure on delegate
            // delegate.errorClousure(400, "Could not upload audio")    
        })
        .initJira(host: "jira-host-url", projectKey: "project-key")

完毕。您的 debugg.it 已经准备好工作了。

额外选项

debugg.it 允许录制音频注释并将其添加到错误描述中。要启用此功能,只需将此行添加到您的 AppDelegate 类配置中即可。

DebuggIt.sharedInstance.recordingEnabled = true

确保您已在 Info.plist 文件中添加了 Microphone Usage Description。例如

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSMicrophoneUsageDescription</key>
	<string>debugg.it record notes</string>
	<!-- 
		Rest of Info.plist file... 
	-->
</dict>
</plist>

作者

Mood Up Labs, [email protected]

许可证

Copyright 2019 MoodUp Team

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://apache.ac.cn/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.