Troubleshooting
Fixes for the most common problems with NexPDF for iOS (Swift) - linking the xcframework, license and watermark issues, fonts, signatures, OCR and memory.
NexPdfCore.xcframework is a static library, so its dependencies are resolved when your app links.
If the linker reports missing C++ symbols, add -lc++ to Other Linker Flags (OTHER_LDFLAGS)
of the app target. The NexPDF iOS demo app sets it. See Installation.
The NexPdf target depends on NexPdfCore.xcframework. With Swift Package Manager, the released
package downloads it from the release; if the download was interrupted, reset the package caches
(File > Packages > Reset Package Caches) and build again. With CocoaPods, unzip NexPdfCore.xcframework.zip into the package folder before pod install; the
NexPdf pod expects it there.
The xcframework has slices for iOS devices (arm64), the iOS simulator (arm64 and x86_64) and macOS on Apple silicon (arm64) only. Mac Catalyst, visionOS, watchOS, tvOS and Intel Macs are not included. See Platforms.
NexPdfUI is iOS only. On macOS, use the NexPdf API and draw the rendered pages in your own
view.
Check what NexPdf.licenseStatus["state"] returns:
unlicensed:activateLicensewas never called, or it threw. Call it once at launch, before you open documents, and log the error message.trial: trial keys always keep the "NexPDF • Trial" watermark.licensed: commercial keys render without a watermark. If you still see one, the image comes from a cache of an earlier render.
iOS keys are bound to the platform ios and the app's bundle id. activateLicense uses
Bundle.main.bundleIdentifier and ios (macos on macOS) by default. Check that:
- the bundle id of the build matches the key character for character (debug configurations often
add a suffix such as
.debug); - a macOS build uses a key issued for
macos.
You can change both in the dashboard and download a re-signed key.
The device's clock is earlier than the key's issue date. Fix the date and time in Settings and activate again.
Your plan does not include that module. See Modules and tiers for which
plan unlocks it, and use NexPdf.isLicensed("xyz") to hide the feature.
In 1.0.0, NexPdfDocument.open sent every ZIP-based file to the Office converter. Update to 1.0.1,
or call NexPdfDocument.openEbook(data:) directly. Both need the conversion module. See
Changelog.
The PDF uses a standard font (Helvetica, Times, Courier) without embedding it. The engine bundles
the Liberation fonts as substitutes. If NexPdf.hasBundledFonts() returns 0, register them
yourself:
for name in ["LiberationSans-Regular", "LiberationSerif-Regular", "LiberationMono-Regular"] {
let url = Bundle.main.url(forResource: name, withExtension: "ttf")!
try NexPdf.registerStandardFont(data: try Data(contentsOf: url))
}The page is a scanned image with no text layer. Run OCR first; it adds an invisible text layer that extraction and search then read.
With "engine": "auto", a loaded neural model is used when it reads the requested languages, and
Tesseract only when the tesseract program can be run and has data for every requested language.
iOS apps cannot run Tesseract, so without neural models OCR on iOS uses the built-in engine, which
reads Latin-script text. On macOS, the engine looks for tesseract on the PATH and in the
Homebrew folders.
The built-in engine reads Latin-script text only. Load a detection model and a recognition model
for the script with NexPdf.ocrLoadModel(optionsJson:model:dictionary:) before calling ocr, and
pass matching languages. NexPdf.ocrModelsJson() lists what is loaded; the report's engine says
neural (<name>) when a model was used. Check that the files are in the app target's Copy Bundle
Resources phase. See OCR.
The file is a dynamic XFA form, which most viewers, the reader included, no longer lay out. Convert
it with xfaToAcroform() or xfaFlatten(); see XFA forms. Scripts in
the form (FormCalc, JavaScript) are not run.
The document was converted as far as possible, but some PDF/A rules still fail; the error message
lists their clauses. Run validatePdfaJson(level:) to see each failure with its page and object.
See PDF/A and PDF/UA validation.
Signing returns the complete signed file as Data. Write those bytes to disk unchanged. Calling
write(to:) or saveBytes() on the document afterwards rewrites the file and invalidates the
signature. See Signatures.
Render at the resolution you show, not more: a 3x screen needs 216 dpi at 100 % zoom, and a
full A4 page at that size is about 18 MB once decoded into a UIImage. Keep only the pages on
screen, call trimMemory() when the app gets a memory warning, and release documents you no longer
need. See Platform notes.
Every NexPDF call is synchronous and runs on the calling thread. Move opening, rendering, OCR, signing and conversion to a background queue or an actor. See Platform notes.
Still stuck? Check Error handling for the meaning of each error, or the general FAQ.