{"__v":16,"_id":"54d0f835cfd8ce0d007de88a","category":{"__v":13,"_id":"547cd7672eaee50800ed108d","pages":["547cd7682eaee50800ed108f","54c8fc417a11f60d0022a83f","54c8fc8b4574700d00f01654","54c903d90174630d00efa894","54c904217a11f60d0022a851","54c904470174630d00efa899","54c9ed8a4574700d00f01869","54c9f27d7a11f60d0022aa82","54d0e25a095c470d00d16420","54d0f835cfd8ce0d007de88a","54d1f61c441be60d00b981cf","54d216df441be60d00b981fe","54f727090585de250064e20d"],"project":"547cd7662eaee50800ed1089","version":"547cd7662eaee50800ed108c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-01T21:02:31.346Z","from_sync":false,"order":0,"slug":"start","title":"Get Started: Mac OS Apps"},"parentDoc":null,"project":"547cd7662eaee50800ed1089","user":"547cd6ac78fd57080023ca99","version":{"__v":9,"_id":"547cd7662eaee50800ed108c","project":"547cd7662eaee50800ed1089","createdAt":"2014-12-01T21:02:30.851Z","releaseDate":"2014-12-01T21:02:30.851Z","categories":["547cd7672eaee50800ed108d","54c8f8ae0174630d00efa874","54c8f8bd7a11f60d0022a832","54c8f8c60174630d00efa876","54c8f8f10174630d00efa877","55155826bc466623002afe83","551558324c7c1e39003735a0","56052058e266000d008971c7","57909a453b845d0e006a37d5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-02-03T16:32:53.608Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"1. Take the steps described in [Integrate DevMateKit](doc:integrate-devmate-kit) if you haven't done it yet.\n2. Add the following code snippet to the `applicationDidFinishLaunching` method of your application delegate class:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[DevMateKit setupIssuesController:nil reportingUnhandledIssues:YES];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"DevMateKit.setupIssuesController(nil, reportingUnhandledIssues: true)\",\n      \"language\": \"swift\",\n      \"name\": \"Swift\"\n    }\n  ]\n}\n[/block]\n3. Build and run your application.\n\nTo test issue the reporting functionality, run the following command in the terminal:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<executable> [-test_crash [delay_sec]] [-test_exception [delay_sec]]\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nwhere:\n*   `<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 add `MyApp.app/Contents/MacOS/MyApp`.\n*   `test_crash` is an argument to initiate crash.\n*   `test_exception` is an argument to initiate exception.\n*   `delay_sec` is time in seconds before an issue dialogue appear (don't specify to open an issue dialogue immediately).\n\nTo learn more, see an example on [GitHub](https://github.com/DevMate/DevMateKit/tree/master/Examples/IssuesExample).\n\n## Customization\nYou 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. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \":::at:::property (nonatomic, retain) NSDictionary *defaultUserInfo;\\n \\nFOUNDATION_EXPORT NSString *const DMIssuesDefaultUserNameKey; // NSString\\nFOUNDATION_EXPORT NSString *const DMIssuesDefaultUserEmailKey; // NSString\\nFOUNDATION_EXPORT NSString *const DMIssuesDefaultCommentKey; // NSString\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nTo send a custom app log in an issue report to DevMate, specify URL to this log file(s).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@property (nonatomic, retain) NSArray *logURLs;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nTo track the relaunch of an application after crash, pass an object that implements the `reporterWillRestartApplication` method as delegate for the issue controller.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@protocol DMIssuesControllerDelegate <NSObject>\\n@optional\\n- (void)reporterWillRestartApplication:(DMIssuesController *)controller;\\n@end\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nTo customize the UI, you need to subclass `DMIssuesWindowController` class and set it to the main controller using the `-[DMIssuesController setIssuesWindowControllerClass:]` method.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"To ensure correct work of the issue reporter, implement `DMIssuesWindowController` subclass and all other resources/classes in a separate framework.\",\n  \"title\": \"NOTE\"\n}\n[/block]","excerpt":"","slug":"issues","type":"basic","title":"Issues"}
1. Take the steps described in [Integrate DevMateKit](doc:integrate-devmate-kit) if you haven't done it yet. 2. Add the following code snippet to the `applicationDidFinishLaunching` method of your application delegate class: [block:code] { "codes": [ { "code": "[DevMateKit setupIssuesController:nil reportingUnhandledIssues:YES];", "language": "objectivec" }, { "code": "DevMateKit.setupIssuesController(nil, reportingUnhandledIssues: true)", "language": "swift", "name": "Swift" } ] } [/block] 3. Build and run your application. To test issue the reporting functionality, run the following command in the terminal: [block:code] { "codes": [ { "code": "<executable> [-test_crash [delay_sec]] [-test_exception [delay_sec]]", "language": "text" } ] } [/block] 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 add `MyApp.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](https://github.com/DevMate/DevMateKit/tree/master/Examples/IssuesExample). ## 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. [block:code] { "codes": [ { "code": "@property (nonatomic, retain) NSDictionary *defaultUserInfo;\n \nFOUNDATION_EXPORT NSString *const DMIssuesDefaultUserNameKey; // NSString\nFOUNDATION_EXPORT NSString *const DMIssuesDefaultUserEmailKey; // NSString\nFOUNDATION_EXPORT NSString *const DMIssuesDefaultCommentKey; // NSString", "language": "objectivec" } ] } [/block] To send a custom app log in an issue report to DevMate, specify URL to this log file(s). [block:code] { "codes": [ { "code": "@property (nonatomic, retain) NSArray *logURLs;", "language": "objectivec" } ] } [/block] To track the relaunch of an application after crash, pass an object that implements the `reporterWillRestartApplication` method as delegate for the issue controller. [block:code] { "codes": [ { "code": "@protocol DMIssuesControllerDelegate <NSObject>\n@optional\n- (void)reporterWillRestartApplication:(DMIssuesController *)controller;\n@end", "language": "objectivec" } ] } [/block] To customize the UI, you need to subclass `DMIssuesWindowController` class and set it to the main controller using the `-[DMIssuesController setIssuesWindowControllerClass:]` method. [block:callout] { "type": "info", "body": "To ensure correct work of the issue reporter, implement `DMIssuesWindowController` subclass and all other resources/classes in a separate framework.", "title": "NOTE" } [/block]