Certain features in PSPDFKit need additional permissions, which will require modifications in your Info.plist file. Adding these descriptive keys was a recommendation since iOS 7 and is strongly enforced since iOS 10. When the system prompts the user to allow access for a certain subsystem, this string is displayed as part of the alert. From the Apple documentation:

Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and which accesses TYPE, must statically declare the intent to do so. Include the KEY in your app’s Info.plist file and provide a purpose string for this key. If your app attempts to access TYPE without a corresponding purpose string, your app exits.

These rules are statically enforced at upload time in iTunes Connect. The static code analyzer can't possibly understand if code is used or not, the descriptions for NSCameraUsageDescription and NSMicrophoneUsageDescription need to be added always when linked with PSPDFKit, even if you do not allow image/sound annotation creation. This is not user-visible, therefore if you do not use this anywhere in your app, so you can use something generic.

Learn more in Apple's Technical Q&A QA1937: Resolving the Privacy-Sensitive Data App Rejection

Microphone Permissions

Creating sound annotations requires that the NSMicrophoneUsageDescription is set in your Info.plist file. This is recommended since iOS 7 and enforced since iOS 10.

If you do not set this, the application will crash with the following error log:

[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.

Edit your Info.plist and assign a descriptive string to this key to fix this issue. PSPDFKit checks for this as well, since 5.5.1, to warn you in advance if this has been forgotten. See our sample projects for examples of such descriptions.

Note: Audio Recording is not available in extension contexts, so this option will always be filtered out.

It is also recommended to add "audio" to the UIBackgroundModes key to allow sound recording in the background. See Apple QA1668 for more details.

App Store Considerations

Apple might request information how they can test UIBackgroundModes. Simply attach a sample PDF that contains sound. The file we provide here contains copyright-free sample music and can be used to test sound annotations. Just make sure you don't accidentially disable sound annotations via excluding it from [PSPDFDocument renderAnnotationTypes].

Image Permissions

Creating image annotations (stamps) requires the NSCameraUsageDescription and/or NSPhotoLibraryUsageDescription keys. Saving images requires NSPhotoLibraryUsageDescription.

Browser Permissions

If you use WKWebView (e.g. via PSPDFWebViewController) you might want to set NSAllowsArbitraryLoadsInWebContent to YES to allow http links to be loaded and https pages that do not yet comply to Apple's App Transport Security rules.

Putting It All Together

Your Info.plist file should have following entries:

<string>Recording sound annotations requires the microphone.</string>
<string>Pictures captured with the camera can be added to the document as image annotations.</string>
<string>Pictures from the photo library can be added to the document as image annotations.</string>
Was this page helpful? We're happy to answer any questions.