Bugsnatch
Bugsnatch is a lightweight bug reporting iOS library written in Swift. It creates a bug report template by collecting application and device information. It can be triggered via a shake gesture or by taking a screenshot.
It supports reporting bugs via an email or via the Productive tool.
Features:
- collecting application and device information
- attaching a screenshot to the email
- comes in two variations:
- Productive
- fully configurable:
- strings customization
- selecting shake gesture or taking a screenshot for the trigger
- adding a custom trigger
- dynamically adding extra debug info
Setting up
For the Email version
- Configure in
AppDelegate
:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let bugsnatchConfig = BugsnatchConfig(
trigger: ScreenshotTrigger(),
triggerActionConfig: EmailConfig(),
extraDebugInfoDelegate: self)
Bugsnatch.shared.setup(config: bugsnatchConfig)
return true
}
- Supporting extra debug info:
extension AppDelegate: BugsnatchExtraDebugInfoDelegate {
var extraDebugInfo: String? {
return Date().debugDescription // example dynamic info
}
}
- On iPhone, the native Mail app should be installed and an account linked.
- If using Gmail: on iPhone go to
Settings
->Passwords & Accounts
->Gmail
and enable Mail.
For the Productive version
- Configure in
AppDelegate
:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// can be found in Productive URL, e.g. https://app.productive.io/someOrganizationName/projects/12345
let organizationName = "someOrganizationName"
let projectId = 12345
let productiveConfig = ProductiveConfig(organizationId: organizationName, projectId: projectId)
let bugsnatchConfig = BugsnatchConfig(
trigger: ScreenshotTrigger(),
triggerActionConfig: productiveConfig)
Bugsnatch.shared.setup(config: bugsnatchConfig)
return true
}
- Add
NSCameraUsageDescription
toInfo.plist
so app wouldn't crash when trying to attach a new photo to the Productive task in WebView.
Adding a custom trigger
Creating your own trigger for triggering Bugsnatch is simple:
- conform to
Triggerable
protocol - call
didTrigger()
onTriggerDelegate
Extra setup
- When using
ShakeGestureTrigger
, addNSPhotoLibraryAddUsageDescription
toInfo.plist
for saving a screenshot on the device.
Example project
To run the example project, clone the repo, and run pod install
from the Example directory first. Example project is configured for the Email version.
Requirements
- iOS 9.0+
- Xcode 10.2+
- Swift 5+
Installation
Bugsnatch is available through CocoaPods. To install it, simply add the following line to your Podfile:
- for the Email version
pod 'Bugsnatch/Email'
- for the Productive version
pod 'Bugsnatch/Productive'
Author
Damjan Dabo, [email protected]
Maintained by Infinum
License
Bugsnatch is available under the MIT license. See the LICENSE file for more info.
- Copyright (c) 2019 Zagreb University of Applied Sciences (TVZ)
- Copyright (c) 2019 Damjan Dabo
- Copyright (c) 2019 Infinum