What is LicenseSpring?

LicenseSpring is a software licensing API, enabling vendors to configure entitlements to their software applications according to their license agreement.

LicenseSpring Apple SDK

This SDK is convenient wrapper around LicenseSpring REST API, providing additional functionality accessing and manipulating licenses.

The entry point to the SDK is LicenseManager. It allows developers to

  • activate licenses
  • request trial keys
  • request app versions / installation information
  • request product details
  • other minor features

The result of license activation is the License object. The License contains information about

  • licenseKey/user assigned to the license
  • license state: active/expired/enabled
  • customer information
  • product details
  • features
  • license/feature comsumption
  • other license-related information

The License also can be

  • synchronized: update information and actualize the License state
  • locally checked: if license is ready to use, without synchronizing (fast)
  • deactivated

Errors

The SDK methods can produce errors if something went wrong. The error is Swift error of class LSError. LSError is NSError-compatible, errorDomain is “com.licenseSpring.errorDomain”. Error codes can be found in Objective-C compatible enum LSErrorCode.

At the moment error descriptions are NOT localized.

Logs

The SDK also contains log subsystem to provide ability for SDK users to collect logs the LicenseSpring SDK produces.

The subsystem can be accessed via LSLog class. To collect logs, you must simply set log handler. Next example shows how to ‘print’ all SDK logs:

LSLog.log = { level, message in
    print("LS-\(level): \(message())")
}