Strategies for Multiple Bundle IDs

PSPDFKit licenses are based on a bundle ID. For projects that require many different bundle IDs, there are a few strategies we recommend in order to simplify dealing with this:

  1. Your app can connect to a server and fetch a license on the fly. That will increase your control and security about the project you release and completely solve the need to recompile. The request might contain the bundle ID and checks with a database if a PSPDFKit license exists for that and returns that one if found. This result can also be cached, so internet access is only required on the first start. Since most applications also require some sort of server/backend/login access, this can be transferred as part of the initial login.

  2. The project can be set up to read the license from the Info.plist. That way no code needs to be recompiled, all there needs to be done is building a new IPA with the updated data. Editing the info.plist can be automated, so the whole workflow doesn’t need manual work.

  3. Many companies use one Xcode project with multiple targets, in that case using preprocessor defines (an #ifdef or even storing the license itself in the project settings) is a simple and effective solution. Of course you can also get the bundle ID at runtime via calling [[NSBundle mainBundle] bundleIdentifier] so based on that you can build a series of if/else that will call the correct license.

Note that you can embed the PSPDFKit.xcframework and PSPDFKitUI.xcframework without a license as well. As long as no PSPDF* classes are called, this is something we tolerate as part of mixed projects where some customers have a PSPDFKit license and some don’t. You need to set the license before accessing any of our classes or functions, else PSPDFKit will complain in the log and your program will exit.