iOS in-app bug reporting for developers and testers, with annotated screenshots and the console log. By Marco Arment.
(tl;dr: Embedded Bugshot plus NSLog()
collection for beta testing.)
Just perform a gesture of your choice — shake, two-finger swipe-up, three-finger double-tap, swipe from right screen edge, etc. — from anywhere in the app, and the Bugshot report window slides up:
It automatically screenshots whatever you were just seeing in the app, and it includes a live NSLog()
console log with no dependencies. (Also compatible with CocoaLumberjack and anything else capable of outputting to the standard system log, or you can add messages manually.)
Tapping the screenshot brings up an embedded version of the Bugshot app: draw bold orange arrows and boxes to annotate, or blur out sensitive information.
Tapping the console brings up a full-screen live console, useful in debugging even when you're not submitting a bug report.
Tap the respective green checkmarks to omit the screenshot or log if you'd like. Implement your own bug submission mechanism by conforming to BugshotSubmissionDelegate
and populating BugshotKit.sharedManager.submissionDelegate
with your custom implementation.
BugshotKit is made for development and ad-hoc beta testing. Please do not ship it in App Store builds.
To help prevent accidentally shipping your app with BugshotKit, I've included a helpful private API call that should cause immediate validation failure upon submitting. If you somehow ship it anyway, it will attempt to detect App Store builds at runtime and disable itself.
These safeguards aren't guaranteed. Please don't rely on them. Remove BugshotKit from your App Store builds.
The easiest way to be sure you're not going to build BugshotKit into your App Store builds is to link to it just in your Debug and Ad-Hoc builds. To do that:
- Build a static library from the BugshotKit Xcode project.
- Put that library, and the header files that come with it, somewhere in your project folder.
- Make sure your app build settings' Library Search Paths and Header Search Paths include the path to where you put these.
- Add
-lBugshotKit
to the Other Linker Flags setting, but only for the Debug and Ad-Hoc builds. - Use a conditional macro (e.g. "
#if defined(DEBUG) || defined(ADHOC)
"..."#endif
") around the BugshotKit import and the invocation, below.
Simply invoke [BugshotKit enableWithNumberOfTouches:...]
from your application:didFinishLaunchingWithOptions:
:
#import "BugshotKit.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[BugshotKit enableWithNumberOfTouches:1 performingGestures:BSKInvocationGestureSwipeUp];
}
That's it, really. Console tracking begins immediately, and on the next run-loop pass, it'll look for a UIWindow
with a rootViewController
and attach its gesture handlers (if any).
Bugshot can also be shown when the user shakes the device, by using BSKWindow
in place of UIWindow
in your application delegate:
self.window = [[BSKWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
If you don't want to use gesture triggers, you can invoke it manually (from a button, maybe):
[BugshotKit show];
See the included LICENSE file. (It's the MIT license.)
If you use BugshotKit, please consider supporting my bill-paying projects:
Thanks.
BugshotKit includes Inconsolata, a free monospace programming font released under the SIL Open Font License, to make its console look nicer.
Add it to your application's resources to use it. If it's absent, BugshotKit will fall back to Courier New, but its console will look worse.