License Registered for a Different Bundle Identifier

You might see the following license error:

PSPDFKitError: Failed to initialize PSPDFKit: Invalid license key. Failed to activate PSPDFKit for 'example.domain'. Error: Your license has been registered for a different bundle identifier - not "example.domain".
Each PSPDFKit license is only valid for one explicit bundle ID and one distribution method (Enterprise or public App Store). Please contact sales at sales@pspdfkit.com with your requirements for a new license. PSPDFKit Web

This error can be caused when you have both example.domain and www.example.domain licensed. Since you’re using the same license key for both domains, it can cause the error to happen intermittently, depending on whether the visitor uses www.example.domain.

Information

Safari simplifies the domain that’s shown to you, so unless you click the address bar to show the full URL, it might show you example.domain/, even though it’s accessing www.example.domain.

To make sure you’re loading the correct license key based on the domain your users are visiting, use something like the following:

let licenseKey = null;
if (document.location.host === "example.domain") {
  licenseKey = "<insert license key for example.domain>";
} else if (document.location.host === "www.example.domain") {
  licenseKey = "<insert license key for www.example.domain>";
} else {
  console.error("Invalid location -> escalate to ops");
}

We’re working on improving this error message so it’s clearer.

Additionally, it’s generally recommend to use a web app on only one subdomain — either www or no subdomain — as this can reduce potential problems. Refer to this page for more information.