# Getting a License for iOS SDK

## License

You can generate the trial license [here](https://ozforensics.com/developers/try_mobile_sdk) or contact us by [email](mailto:info@ozforensics.com) to get a productive license. To create the license, your `bundle id` is required. After you get a license file, there are two ways to add the license to your project.

1. Rename this file to **forensics.license** and put it into the project. In this case, you don't need to set the path to the license.
2. During the runtime: when initializing SDK, use the following method. &#x20;

```swift
OZSDK(licenseSources: [.licenseFileName(“forensics.license”)]) { licenseData, error in
      if let error = error {
        print(error)
      }
    }
```

`or`

```swift
OZSDK(licenseSources: [.licenseFilePath(“path_to_file”)]) { licenseData, error in
      if let error = error {
        print(error)
      }
    }
```

`LicenseSource` a source of license, and `LicenseData` is the information about your license. Please note: this method checks whether you have an active license or not and if yes, this license won't be replaced with a new one. To force the license replacement, use  the `setLicense` method.

In case of any license errors, the system will use your error handling code as shown above. Otherwise, the system will return information about license. To check the license data manually, use `OZSDK.licenseData`.

### Possible License Errors

<table><thead><tr><th width="347">Error message</th><th>What to Do</th></tr></thead><tbody><tr><td>License error. License at (your_URI) not found</td><td>The license file is missing. Please check its name and path to the file.</td></tr><tr><td>License error. Cannot parse license from (your_URI), invalid format</td><td>The license file is somehow damaged. Please email us the file.</td></tr><tr><td>License error. Bundle company.application.id is not in the list allowed by license (bundle.id1, bundle.id2)</td><td>The bundle (application) identifier you specified is missing in the allowed list. Please check the spelling, if it is correct, you need to get another license for your application.</td></tr><tr><td>License error. Current date yyyy-mm-dd hh:mm:ss is later than license expiration date yyyy-mm-dd hh:mm:ss</td><td>Your license has expired. Please contact us.</td></tr><tr><td>License is not initialized.</td><td>You haven't initialized the license. Please add the license to your project as described above.</td></tr></tbody></table>
