CBLLicenseVerification
Objective-C
@interface CBLLicenseVerification : NSObject
Swift
class CascableCoreLicenseVerification : NSObject
A class to register your CascableCore license.
-
Register your license file with CascableCore.
This should be done before calling any other CascableCore APIs.
Declaration
Objective-C
+ (CBLLicenseVerificationResult)applyLicense:(NSData *_Nonnull)licenseData;Swift
class func apply(license licenseData: Data) -> LicenseVerificationResultParameters
licenseDataThe license data to apply.
Return Value
The result of the license.
-
Applies the given license key with the default token refresh mode. This should be done (and the completion handler received) before calling any other CascableCore APIs, otherwise an “unlicensed” dialog may be shown to the user.
For more information, see the documentation for
-applyLicenseKey:offlineToken:tokenRefreshMode:completionHandler:.Declaration
Objective-C
+ (void)applyLicenseKey:(NSString *_Nonnull)licenseKey offlineToken:(NSData *_Nullable)offlineToken completionHandler: (CBLLicenseKeyCompletionHandler _Nonnull)completionHandler;Swift
class func apply(licenseKey: String, offlineToken: Data?) async -> (LicenseKeyVerificationResult, (any LicenseKeyOfflineToken)?) -
Applies the given license key. This should be done (and the completion handler received) before calling any other CascableCore APIs, otherwise an “unlicensed” dialog may be shown to the user.
The CascableCore license key verification process involves connecting to the Cascable licensing service to verify the license key and retrieve an offline activation token. Once verified, that token is returned via the completion callback for the caller to store and supply in subsequent calls to this method. Activation tokens are small (less than a kilobyte) and appropriate for storing in the Keychain, User Defaults, etc.
NOTE: Offline activation tokens are per end-user device, and shouldn’t be synced around.
If you provide a valid offline activation token alongside your license key, CascableCore will not need to connect to the licensing service again so long as the token isn’t expired. By default, CascableCore won’t contact the service to get a new token unless the given one has less than seven days of validity remaining.
You can customise this behaviour with the
refreshModeparameter. It’s also safe to call this method more than once in your app’s lifecycle, so if you’re aware that your app may be entering an extended period with no internet access, you can call this with theCBLLicenseKeyOfflineTokenRefreshModeAlwaysrefresh mode to get a new token for the longest offline validity period.If the connection to the licensing service fails for whatever reason, the overall operation will succeed as long as a valid offline activation token is present, no matter the value of
refreshMode. In practice, this means that the only time an internet connection is required is if you have no token at all (i.e., an end-user installation’s first launch) or if your previously granted token has expired.Declaration
Objective-C
+ (void)applyLicenseKey:(NSString *_Nonnull)licenseKey offlineToken:(NSData *_Nullable)offlineToken tokenRefreshMode:(CBLLicenseKeyOfflineTokenRefreshMode)refreshMode completionHandler: (CBLLicenseKeyCompletionHandler _Nonnull)completionHandler;Swift
class func apply(licenseKey: String, offlineToken: Data?, refreshMode: LicenseKeyOfflineTokenRefreshMode) async -> (LicenseKeyVerificationResult, (any LicenseKeyOfflineToken)?)