- Take the steps described in Integrate DevMateKit if you haven't done it yet.
- Add the following code snippet to the
applicationDidFinishLaunching
method of your application delegate class:
[DevMateKit setupIssuesController:nil reportingUnhandledIssues:YES];
DevMateKit.setupIssuesController(nil, reportingUnhandledIssues: true)
- Build and run your application.
To test issue the reporting functionality, run the following command in the terminal:
<executable> [-test_crash [delay_sec]] [-test_exception [delay_sec]]
where:
<executable>
is a path to the main executable of your app (e.g.,<my_app_path>/MyApp.app/Contents/MacOS/MyApp
). You can drag and drop your application from Xcode to Terminal and addMyApp.app/Contents/MacOS/MyApp
.test_crash
is an argument to initiate crash.test_exception
is an argument to initiate exception.delay_sec
is time in seconds before an issue dialogue appear (don't specify to open an issue dialogue immediately).
To learn more, see an example on GitHub.
Customization
You can automatically fill in 'Name' and 'Email' fields of an issue reporting dialog with the values specified by a user during activation. Also, you can add some predefined text to the problem description field.
@property (nonatomic, retain) NSDictionary *defaultUserInfo;
FOUNDATION_EXPORT NSString *const DMIssuesDefaultUserNameKey; // NSString
FOUNDATION_EXPORT NSString *const DMIssuesDefaultUserEmailKey; // NSString
FOUNDATION_EXPORT NSString *const DMIssuesDefaultCommentKey; // NSString
To send a custom app log in an issue report to DevMate, specify URL to this log file(s).
@property (nonatomic, retain) NSArray *logURLs;
To track the relaunch of an application after crash, pass an object that implements the reporterWillRestartApplication
method as delegate for the issue controller.
@protocol DMIssuesControllerDelegate <NSObject>
@optional
- (void)reporterWillRestartApplication:(DMIssuesController *)controller;
@end
To customize the UI, you need to subclass DMIssuesWindowController
class and set it to the main controller using the -[DMIssuesController setIssuesWindowControllerClass:]
method.
NOTE
To ensure correct work of the issue reporter, implement
DMIssuesWindowController
subclass and all other resources/classes in a separate framework.