{"_id":"591f17b021d2ff0f00cf5a56","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"},"user":"547cd6ac78fd57080023ca99","__v":0,"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"},"project":"547cd7662eaee50800ed1089","parentDoc":null,"updates":["5583c484fb52ee0d0015d01a","561cf309fd54a40d00ced24c","56276536e2ce610d004e3e96","563787ec7ca5de0d00286a75","564c495a47388a1700f6feee","564c4baac9847b21008bdcd5","581144168bb7080f0089185d"],"next":{"pages":[],"description":""},"createdAt":"2015-01-28T15:44:25.250Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"# Installing Kevlar\nEnabling Activation and Trial functionality requires integration of the specific Kevlar library. This library is unique for each application in DevMate and, therefore can be used only for one particular app. It ensures secure communication between your app and DevMate as well as manages license information on the app's side.\n\n1. Take the steps described in [Integrate DevMateKit](doc:integrate-devmate-kit) if you haven't done it yet.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"NOTE\",\n  \"body\": \"The latest version of DevMateKit is available [here](https://github.com/DevMate/DevMateKit/releases/latest).\"\n}\n[/block]\n2.  Download a Kevlar library from the corresponding page of DevMate's Add Application wizard. Alternatively, choose your app from the list of applications and go to Settings > DevMateKit. Disclose 'Activations and Trial' block and click Download Kevlar Library. \n3. Extract files from the downloaded archive and drop them to your project. Apply the following settings in the dialogue that appears:\n * Select the 'Copy items if needed' checkbox\n * Choose the 'Create groups' option\n * Deselect all items in the 'Add to targets' list.\n[block:html]\n{\n  \"html\": \"<iframe src=\\\"https://player.vimeo.com/video/121876231?loop=0&title=0&byline=0&portrait=0\\\" width=\\\"750\\\" height=\\\"458\\\" frameborder=\\\"0\\\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>\"\n}\n[/block]\n4. Link the Kevlar library to your project. Go to the Build Settings tab and add the following string to Other Linker Flags:\n * If the Kevlar folder is located in the project root folder:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-ObjC \\\"$(PROJECT_DIR)/Kevlar/libkevlar.a\\\" -lc++ -framework Security -framework IOKit\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n * If the Kevlar folder is located in other location:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-ObjC <path_to_Kevlar_lib> -lc++ -framework Security -framework IOKit\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n# Enable Activations\n\n1.  Add the following code to the import section of your application 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 \\\"DMKevlarApplication.h\\\"\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Before importing the DevMateKit framework, please make sure that the DMKevlarApplication.h header file is included. Otherwise, you will receive a warning console message (`WARNING: Need Kevlar library for correct work`).\",\n  \"title\": \"NOTE\"\n}\n[/block]\n2.  Add the following method to your application delegate class implementation:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (IBAction)startActivationProcess:(id)sender {\\n    if (!DMKIsApplicationActivated(NULL)) {\\n        [DevMateKit runActivationDialog:nil inMode:DMActivationModeFloating];\\n    }\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \":::at:::IBAction func startActivationProcess(sender: AnyObject?) {\\n    // Swift does’t work with macros, so check our Examples project on GitHub (https://github.com/DevMate/DevMateKit)\\n    //     to see how to create _my_secret_activation_check variable\\n    var kevlarError = DMKevlarError.testError\\n    if (false == _my_secret_activation_check!(&kevlarError).boolValue || kevlarError != DMKevlarError.noError) {\\n        DevMateKit.runActivationDialog(nil, in: DMActivationMode.modal)\\n    }\\n}\",\n      \"language\": \"swift\",\n      \"name\": \"Swift 3\"\n    }\n  ]\n}\n[/block]\n3.  Connect the newly added action method with the corresponding menu item or button inside the XIB files.\n\nSee [GitHub example](https://github.com/DevMate/DevMateKit/tree/master/Examples/ActivationsExample) for more information.\n\n# Enable Trial\n1. Add the following code to the `applicationDidFinishLaunching` method of your application delegate class to initialize time trial. This example is for a one-week trial period:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"if (!DMKIsApplicationActivated(NULL)) {\\n\\t\\t[DevMateKit setupTimeTrial:nil withTimeInterval:kDMTrialWeek];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"// Swift does’t work with macros, so check our Examples project on GitHub (https://github.com/DevMate/DevMateKit)\\n//     to see how to create _my_secret_activation_check variable\\nif !_my_secret_activation_check!(nil).boolValue {\\n    DevMateKit.setupTimeTrial(nil, withTimeInterval: kDMTrialWeek)\\n}\",\n      \"language\": \"swift\",\n      \"name\": \"Swift 3\"\n    }\n  ]\n}\n[/block]\n2. Build and run your application.\n\nSee our [GitHub example](https://github.com/DevMate/DevMateKit/tree/master/Examples/TimeTrialExample) for more information.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"NOTE\",\n  \"body\": \"While we do our best to keep DevMate frameworks secure and reliable, you should protect your software carefully against cracking attempts as well. \\n\\nFor your convenience, we prepared a few [tips](doc:anticrack-protection-tips) that will help you protect your app.\"\n}\n[/block]\n# Functionality-Based Trial\n\nYou can set a trial period that ends after a predefined number of applications is launched or when a certain action is taken (for example, a click on a button). See our [GitHub example](https://github.com/DevMate/DevMateKit/blob/master/Examples/CustomTrialExample/) for more information.\n\n# Customize User Interfaces\n\nThere are several methods of customizing activation windows:\n* Instead of `+[DMActivationController sharedController]` or `+[DMActivationController defaultController]` methods initialize controller with `-[DMActivationController initWithWindowNibName:]` passing your .nib file name here.\n* Create your own subclasses of the `DMStepController` class (with its XIB) and register/re-register them using the `-registeredStepController:withNibName:forActivationStep:` method.\n* Use `DMActivationController` delegate methods to change controller behavior.\n\n# Setting Up Activation by URL Scheme\n\nActivation by the URL scheme enables activation directly from an email or web page. To configure activation by URL scheme, add the following code snippet to the info.plist file of your application:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<key>CFBundleURLTypes</key>\\n<array>\\n    <dict>\\n        <key>CFBundleURLName</key>\\n        <string>com.devmate.ActivationScheme</string>\\n        <key>CFBundleURLSchemes</key>\\n        <array>\\n            <string>schemename1</string>\\n            ... // other scheme names that also will be uses for activation\\n        </array>\\n\\t</dict>\\n    .... // other URL schemes used for other purposes\\n</array>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n`CFBundleURLTypes` is a special key, which contains `NSArray` of `NSDictionaries`. One of them is used for registration of activation schemes. It contains a `CFBundleURLName` special key with the value set to `com.devmate.ActivationScheme`. \n\n`<string>schemename1</string>` is the declaration of the scheme (replace `schemname1` with a name of a URL scheme to be used).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"NOTE\",\n  \"body\": \"You can view an example on [GitHub](https://github.com/DevMate/DevMateKit/tree/master/Examples/URLSchemeExample).\"\n}\n[/block]\n# Paddle Checkout\nPaddle's checkout simplifies software purchases by integrating a checkout page directly into the application. \n\n# Deactivate License\nIf you want to add an ability to deactivate a license from UI of your app, connect `-[NSApplication invalidateLicense]` to the corresponding button or menu item.","excerpt":"","slug":"activations-and-trial","type":"basic","title":"Activations and Trial"}

Activations and Trial


# Installing Kevlar Enabling Activation and Trial functionality requires integration of the specific Kevlar library. This library is unique for each application in DevMate and, therefore can be used only for one particular app. It ensures secure communication between your app and DevMate as well as manages license information on the app's side. 1. Take the steps described in [Integrate DevMateKit](doc:integrate-devmate-kit) if you haven't done it yet. [block:callout] { "type": "info", "title": "NOTE", "body": "The latest version of DevMateKit is available [here](https://github.com/DevMate/DevMateKit/releases/latest)." } [/block] 2. Download a Kevlar library from the corresponding page of DevMate's Add Application wizard. Alternatively, choose your app from the list of applications and go to Settings > DevMateKit. Disclose 'Activations and Trial' block and click Download Kevlar Library. 3. Extract files from the downloaded archive and drop them to your project. Apply the following settings in the dialogue that appears: * Select the 'Copy items if needed' checkbox * Choose the 'Create groups' option * Deselect all items in the 'Add to targets' list. [block:html] { "html": "<iframe src=\"https://player.vimeo.com/video/121876231?loop=0&title=0&byline=0&portrait=0\" width=\"750\" height=\"458\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>" } [/block] 4. Link the Kevlar library to your project. Go to the Build Settings tab and add the following string to Other Linker Flags: * If the Kevlar folder is located in the project root folder: [block:code] { "codes": [ { "code": "-ObjC \"$(PROJECT_DIR)/Kevlar/libkevlar.a\" -lc++ -framework Security -framework IOKit", "language": "text" } ] } [/block] * If the Kevlar folder is located in other location: [block:code] { "codes": [ { "code": "-ObjC <path_to_Kevlar_lib> -lc++ -framework Security -framework IOKit", "language": "text" } ] } [/block] # Enable Activations 1. Add the following code to the import section of your application Objective-C delegate class file or to the special bridging header of your Swift target: [block:code] { "codes": [ { "code": "#import \"DMKevlarApplication.h\"", "language": "objectivec" } ] } [/block] [block:callout] { "type": "info", "body": "Before importing the DevMateKit framework, please make sure that the DMKevlarApplication.h header file is included. Otherwise, you will receive a warning console message (`WARNING: Need Kevlar library for correct work`).", "title": "NOTE" } [/block] 2. Add the following method to your application delegate class implementation: [block:code] { "codes": [ { "code": "- (IBAction)startActivationProcess:(id)sender {\n if (!DMKIsApplicationActivated(NULL)) {\n [DevMateKit runActivationDialog:nil inMode:DMActivationModeFloating];\n }\n}", "language": "objectivec" }, { "code": "@IBAction func startActivationProcess(sender: AnyObject?) {\n // Swift does’t work with macros, so check our Examples project on GitHub (https://github.com/DevMate/DevMateKit)\n // to see how to create _my_secret_activation_check variable\n var kevlarError = DMKevlarError.testError\n if (false == _my_secret_activation_check!(&kevlarError).boolValue || kevlarError != DMKevlarError.noError) {\n DevMateKit.runActivationDialog(nil, in: DMActivationMode.modal)\n }\n}", "language": "swift", "name": "Swift 3" } ] } [/block] 3. Connect the newly added action method with the corresponding menu item or button inside the XIB files. See [GitHub example](https://github.com/DevMate/DevMateKit/tree/master/Examples/ActivationsExample) for more information. # Enable Trial 1. Add the following code to the `applicationDidFinishLaunching` method of your application delegate class to initialize time trial. This example is for a one-week trial period: [block:code] { "codes": [ { "code": "if (!DMKIsApplicationActivated(NULL)) {\n\t\t[DevMateKit setupTimeTrial:nil withTimeInterval:kDMTrialWeek];\n}", "language": "objectivec" }, { "code": "// Swift does’t work with macros, so check our Examples project on GitHub (https://github.com/DevMate/DevMateKit)\n// to see how to create _my_secret_activation_check variable\nif !_my_secret_activation_check!(nil).boolValue {\n DevMateKit.setupTimeTrial(nil, withTimeInterval: kDMTrialWeek)\n}", "language": "swift", "name": "Swift 3" } ] } [/block] 2. Build and run your application. See our [GitHub example](https://github.com/DevMate/DevMateKit/tree/master/Examples/TimeTrialExample) for more information. [block:callout] { "type": "info", "title": "NOTE", "body": "While we do our best to keep DevMate frameworks secure and reliable, you should protect your software carefully against cracking attempts as well. \n\nFor your convenience, we prepared a few [tips](doc:anticrack-protection-tips) that will help you protect your app." } [/block] # Functionality-Based Trial You can set a trial period that ends after a predefined number of applications is launched or when a certain action is taken (for example, a click on a button). See our [GitHub example](https://github.com/DevMate/DevMateKit/blob/master/Examples/CustomTrialExample/) for more information. # Customize User Interfaces There are several methods of customizing activation windows: * Instead of `+[DMActivationController sharedController]` or `+[DMActivationController defaultController]` methods initialize controller with `-[DMActivationController initWithWindowNibName:]` passing your .nib file name here. * Create your own subclasses of the `DMStepController` class (with its XIB) and register/re-register them using the `-registeredStepController:withNibName:forActivationStep:` method. * Use `DMActivationController` delegate methods to change controller behavior. # Setting Up Activation by URL Scheme Activation by the URL scheme enables activation directly from an email or web page. To configure activation by URL scheme, add the following code snippet to the info.plist file of your application: [block:code] { "codes": [ { "code": "<key>CFBundleURLTypes</key>\n<array>\n <dict>\n <key>CFBundleURLName</key>\n <string>com.devmate.ActivationScheme</string>\n <key>CFBundleURLSchemes</key>\n <array>\n <string>schemename1</string>\n ... // other scheme names that also will be uses for activation\n </array>\n\t</dict>\n .... // other URL schemes used for other purposes\n</array>", "language": "xml" } ] } [/block] `CFBundleURLTypes` is a special key, which contains `NSArray` of `NSDictionaries`. One of them is used for registration of activation schemes. It contains a `CFBundleURLName` special key with the value set to `com.devmate.ActivationScheme`. `<string>schemename1</string>` is the declaration of the scheme (replace `schemname1` with a name of a URL scheme to be used). [block:callout] { "type": "info", "title": "NOTE", "body": "You can view an example on [GitHub](https://github.com/DevMate/DevMateKit/tree/master/Examples/URLSchemeExample)." } [/block] # Paddle Checkout Paddle's checkout simplifies software purchases by integrating a checkout page directly into the application. # Deactivate License If you want to add an ability to deactivate a license from UI of your app, connect `-[NSApplication invalidateLicense]` to the corresponding button or menu item.