{"_id":"591f17b021d2ff0f00cf5a54","__v":0,"project":"547cd7662eaee50800ed1089","parentDoc":null,"user":"547cd6ac78fd57080023ca99","category":{"_id":"591f17af21d2ff0f00cf5a40","project":"547cd7662eaee50800ed1089","version":"591f17ae21d2ff0f00cf5a3f","__v":0,"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"},"version":{"_id":"591f17ae21d2ff0f00cf5a3f","__v":1,"project":"547cd7662eaee50800ed1089","createdAt":"2017-05-19T16:05:02.775Z","releaseDate":"2017-05-19T16:05:02.775Z","categories":["591f17af21d2ff0f00cf5a40","591f17af21d2ff0f00cf5a41","591f17af21d2ff0f00cf5a42","591f17af21d2ff0f00cf5a43","591f17af21d2ff0f00cf5a44","591f17af21d2ff0f00cf5a45","591f17af21d2ff0f00cf5a46","591f17af21d2ff0f00cf5a47","591f17af21d2ff0f00cf5a48"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.1","version":"1.0.1"},"updates":["554a091c57ee1523007e397a","5577fbe5e6063e0d004815a1","5583c3b0afccfd0d00fcb06e","57ac8cd08f312d0e00e96c60"],"next":{"pages":[],"description":""},"createdAt":"2015-01-28T15:13:15.855Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"#What is DevMateKit?\nDevMateKit is a core component for communication between your application and DevMate. It provides the following capabilities:\n*   Application launch tracking\n*   Activation and trial period management\n*   Crash and feedback reporting\n*   Updates management\n\nYou get application launch tracking out-of-the-box, but other features must be set up. Ensure your Xcode version is 4.0 or higher before you start integration and configuration process.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"If you are going to distribute your app on the Mac App Store, you'll have to disable DevMate's activation and update functionality. Follow the instructions [below](#section-devmatekit-for-mac-app-store) to configure DevMateKit correctly and make your app work properly within the Mac App Store environment.\",\n  \"title\": \"NOTE\"\n}\n[/block]\n\n#Download DevMateKit\n1. Download a ZIP archive containing the latest version of the DevMateKit framework from either the Add Application wizard or [GitHub](https://github.com/DevMate/DevMateKit/releases/latest).\n2. Extract `DevMateKit.framework` from the downloaded archive.\n\n#Installation from CocoaPods\nYou can integrate DevMateKit into your project using [CocoaPods](http://cocoadocs.org/docsets/DevMateKit/). Here is a podfile:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"platform :osx, '10.7'\\npod 'DevMateKit'\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n#Add Framework to your project\n1. Open your application project in Xcode. \n2. Drop the DevMateKit folder to your project and apply the following settings in the dialogue that appears: \n * Select the 'Copy items if needed' checkbox\n * Choose the 'Create groups for any added folders' option\n * Select the checkbox next to your project target in the 'Add to targets' list.\n3. Select your project in the Project Navigator and then select your application target.\n4. Go to the Build Phases tab.\n5. Copy DevMateKit.framework from the Project Navigator to the Link Binary With Libraries build phase list (if it isn't set).\n6. Choose Editor > Add Build Phase > Add Copy Files Build Phase.\n7. Disclose the Copy Files section and choose the Frameworks option from the Destination list.\n8. Copy DevMateKit.framework from the Project Navigator to the Copy Files section.\n[block:html]\n{\n  \"html\": \"<iframe src=\\\"https://player.vimeo.com/video/121889075?loop=0&title=0&byline=0&portrait=0\\\" width=\\\"750\\\" height=\\\"513\\\" frameborder=\\\"0\\\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>\"\n}\n[/block]\n9. Go to the Build Settings tab and switch to 'All' settings.\n10. Set the Runpath Search Paths value to the following string:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \":::at:::executable_path/../Frameworks\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n11. Set the Framework Search Paths value to the following string:\n * If the DevMateKit folder is located in the project root folder:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"$(PROJECT_DIR)/DevMateKit/DevMateKit.framework/Frameworks\\\"\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n  * If the DevMateKit folder is located in other location:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"$(PROJECT_DIR)/<Path_to_DevMateKit_folder>/DevMateKit.framework/Frameworks\\\"\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n12. For the Swift project, create a bridging header and add its path to the Objective-C Bridging Header build setting of your target (if it isn't set).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"NOTE\",\n  \"body\": \"If you need examples, check the following links:\\n* https://github.com/DevMate/DevMateKit/tree/master/Examples/Examples.xcodeproj\\n* https://github.com/DevMate/DevMateKit/tree/master/Examples/SwiftExample (for Swift projects)\"\n}\n[/block]\n#Test Integration\n1.  Add the following string to the import section of your app's Objective-C delegate class file or to the special bridging header of your Swift target:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import <DevMateKit/DevMateKit.h>\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n2.  Copy and paste the following code to the `applicationDidFinishLaunching` method of your application delegate class:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[DevMateKit sendTrackingReport:nil delegate:nil];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"DevMateKit.sendTrackingReport(nil, delegate: nil)\",\n      \"language\": \"swift\",\n      \"name\": \"Swift\"\n    }\n  ]\n}\n[/block]\nNow, your application will send launch reports to DevMate so that you could start collecting your software usage statistics.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"NOTE\",\n  \"body\": \"If you need an example, check https://github.com/DevMate/DevMateKit/tree/master/Examples/TrackingExample.\"\n}\n[/block]\n#Debug Logs Listening (optional)\nDevMateKit has a lot of debug logs that can be helpful during the integration of DevMate's new features. You can turn them on by adding the `DM_ENABLE_DEBUG_LOGGING_ALL` variable to your scheme (choose the Edit Scheme menu item).\n\n#Customization\nDevMateKit sends application launch reports that contain information about the activation state provided by the DevMate activation system. \n\nIf you want to use your own activation system, initialize the `DMTrackingReporter` object with infoProvider that conforms to the `DMTrackingReporterInfoProvider` protocol.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@protocol DMTrackingReporterInfoProvider <NSObject>\\n@optional\\n- (NSUInteger)applicationLaunchCount:(DMTrackingReporter *)reporter;\\n- (BOOL)isApplicationFirstInstall:(DMTrackingReporter *)reporter;\\n- (DMAppActivationStatus)applicationActivationStatus:(DMTrackingReporter *)reporter;\\n- (DMAppTrialValue)applicationTrialValue:(DMTrackingReporter *)reporter;\\n@end\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nMore information about parameters is available in `<DevMateKit/DMTrackingBase.h>`.\n\nAlso, if you want to know whether the report was sent, you can provide a reporter delegate that must conform to the `DMTrackingReporterDelegate` protocol:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@protocol DMTrackingReporterDelegate <NSObject>\\n@optional\\n- (void)trackingReporter:(DMTrackingReporter *)reporter didFinishSendingReportWithSuccess:(BOOL)success;\\n@end\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n#DevMateKit for Mac App Store\nIf you want to distribute your app via Mac App Store, you must disable activations and updates via DevMateKit. However, you still can use DevMate for gathering app usage stats, collecting issue reports and feedback messages.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"NOTE\",\n  \"body\": \"This feature is supported for DevMateKit v.1.3 and above. If you are using an older version, you need to update it.\"\n}\n[/block]\n1. Download a specific version of DevMateKit for MAS from [GitHub](https://github.com/DevMate/DevMateKit/releases) (DevMateKit_MAS.zip)\n2. Follow the instructions [above](#section-add-framework-to-your-project).\n3. Add new *‘Run Script’* phase and add there the following string:\n\n````    \n    \"${PROJECT_DIR}/DevMateKit/update_reporter_id.sh\"\n````\n\nThe last step is necessary because DevMateKit contains the special application *‘Problem Reporter Sandboxed.app’* with its unique bundle ID. When you try to submit your app to Mac App Store, an error may occur, because the other app with DevMateKit is already published on MAS. The script changes the bundle ID of *‘Problem Reporter Sandboxed.app’* by appending your app’s name to the original ID like this: `com.devmate.Problem-Reporter-Sandboxed.MyApp`\nand resigns all necessary components with your code sign identity.","excerpt":"","slug":"integrate-devmate-kit","type":"basic","title":"Integrate DevMateKit"}

Integrate DevMateKit


#What is DevMateKit? DevMateKit is a core component for communication between your application and DevMate. It provides the following capabilities: * Application launch tracking * Activation and trial period management * Crash and feedback reporting * Updates management You get application launch tracking out-of-the-box, but other features must be set up. Ensure your Xcode version is 4.0 or higher before you start integration and configuration process. [block:callout] { "type": "info", "body": "If you are going to distribute your app on the Mac App Store, you'll have to disable DevMate's activation and update functionality. Follow the instructions [below](#section-devmatekit-for-mac-app-store) to configure DevMateKit correctly and make your app work properly within the Mac App Store environment.", "title": "NOTE" } [/block] #Download DevMateKit 1. Download a ZIP archive containing the latest version of the DevMateKit framework from either the Add Application wizard or [GitHub](https://github.com/DevMate/DevMateKit/releases/latest). 2. Extract `DevMateKit.framework` from the downloaded archive. #Installation from CocoaPods You can integrate DevMateKit into your project using [CocoaPods](http://cocoadocs.org/docsets/DevMateKit/). Here is a podfile: [block:code] { "codes": [ { "code": "platform :osx, '10.7'\npod 'DevMateKit'", "language": "ruby" } ] } [/block] #Add Framework to your project 1. Open your application project in Xcode. 2. Drop the DevMateKit folder to your project and apply the following settings in the dialogue that appears: * Select the 'Copy items if needed' checkbox * Choose the 'Create groups for any added folders' option * Select the checkbox next to your project target in the 'Add to targets' list. 3. Select your project in the Project Navigator and then select your application target. 4. Go to the Build Phases tab. 5. Copy DevMateKit.framework from the Project Navigator to the Link Binary With Libraries build phase list (if it isn't set). 6. Choose Editor > Add Build Phase > Add Copy Files Build Phase. 7. Disclose the Copy Files section and choose the Frameworks option from the Destination list. 8. Copy DevMateKit.framework from the Project Navigator to the Copy Files section. [block:html] { "html": "<iframe src=\"https://player.vimeo.com/video/121889075?loop=0&title=0&byline=0&portrait=0\" width=\"750\" height=\"513\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>" } [/block] 9. Go to the Build Settings tab and switch to 'All' settings. 10. Set the Runpath Search Paths value to the following string: [block:code] { "codes": [ { "code": "@executable_path/../Frameworks", "language": "objectivec" } ] } [/block] 11. Set the Framework Search Paths value to the following string: * If the DevMateKit folder is located in the project root folder: [block:code] { "codes": [ { "code": "\"$(PROJECT_DIR)/DevMateKit/DevMateKit.framework/Frameworks\"", "language": "objectivec" } ] } [/block] * If the DevMateKit folder is located in other location: [block:code] { "codes": [ { "code": "\"$(PROJECT_DIR)/<Path_to_DevMateKit_folder>/DevMateKit.framework/Frameworks\"", "language": "objectivec" } ] } [/block] 12. For the Swift project, create a bridging header and add its path to the Objective-C Bridging Header build setting of your target (if it isn't set). [block:callout] { "type": "info", "title": "NOTE", "body": "If you need examples, check the following links:\n* https://github.com/DevMate/DevMateKit/tree/master/Examples/Examples.xcodeproj\n* https://github.com/DevMate/DevMateKit/tree/master/Examples/SwiftExample (for Swift projects)" } [/block] #Test Integration 1. Add the following string to the import section of your app's Objective-C delegate class file or to the special bridging header of your Swift target: [block:code] { "codes": [ { "code": "#import <DevMateKit/DevMateKit.h>", "language": "objectivec" } ] } [/block] 2. Copy and paste the following code to the `applicationDidFinishLaunching` method of your application delegate class: [block:code] { "codes": [ { "code": "[DevMateKit sendTrackingReport:nil delegate:nil];", "language": "objectivec" }, { "code": "DevMateKit.sendTrackingReport(nil, delegate: nil)", "language": "swift", "name": "Swift" } ] } [/block] Now, your application will send launch reports to DevMate so that you could start collecting your software usage statistics. [block:callout] { "type": "info", "title": "NOTE", "body": "If you need an example, check https://github.com/DevMate/DevMateKit/tree/master/Examples/TrackingExample." } [/block] #Debug Logs Listening (optional) DevMateKit has a lot of debug logs that can be helpful during the integration of DevMate's new features. You can turn them on by adding the `DM_ENABLE_DEBUG_LOGGING_ALL` variable to your scheme (choose the Edit Scheme menu item). #Customization DevMateKit sends application launch reports that contain information about the activation state provided by the DevMate activation system. If you want to use your own activation system, initialize the `DMTrackingReporter` object with infoProvider that conforms to the `DMTrackingReporterInfoProvider` protocol. [block:code] { "codes": [ { "code": "@protocol DMTrackingReporterInfoProvider <NSObject>\n@optional\n- (NSUInteger)applicationLaunchCount:(DMTrackingReporter *)reporter;\n- (BOOL)isApplicationFirstInstall:(DMTrackingReporter *)reporter;\n- (DMAppActivationStatus)applicationActivationStatus:(DMTrackingReporter *)reporter;\n- (DMAppTrialValue)applicationTrialValue:(DMTrackingReporter *)reporter;\n@end", "language": "objectivec" } ] } [/block] More information about parameters is available in `<DevMateKit/DMTrackingBase.h>`. Also, if you want to know whether the report was sent, you can provide a reporter delegate that must conform to the `DMTrackingReporterDelegate` protocol: [block:code] { "codes": [ { "code": "@protocol DMTrackingReporterDelegate <NSObject>\n@optional\n- (void)trackingReporter:(DMTrackingReporter *)reporter didFinishSendingReportWithSuccess:(BOOL)success;\n@end", "language": "objectivec" } ] } [/block] #DevMateKit for Mac App Store If you want to distribute your app via Mac App Store, you must disable activations and updates via DevMateKit. However, you still can use DevMate for gathering app usage stats, collecting issue reports and feedback messages. [block:callout] { "type": "info", "title": "NOTE", "body": "This feature is supported for DevMateKit v.1.3 and above. If you are using an older version, you need to update it." } [/block] 1. Download a specific version of DevMateKit for MAS from [GitHub](https://github.com/DevMate/DevMateKit/releases) (DevMateKit_MAS.zip) 2. Follow the instructions [above](#section-add-framework-to-your-project). 3. Add new *‘Run Script’* phase and add there the following string: ```` "${PROJECT_DIR}/DevMateKit/update_reporter_id.sh" ```` The last step is necessary because DevMateKit contains the special application *‘Problem Reporter Sandboxed.app’* with its unique bundle ID. When you try to submit your app to Mac App Store, an error may occur, because the other app with DevMateKit is already published on MAS. The script changes the bundle ID of *‘Problem Reporter Sandboxed.app’* by appending your app’s name to the original ID like this: `com.devmate.Problem-Reporter-Sandboxed.MyApp` and resigns all necessary components with your code sign identity.