Some test text!

Search
Hamburger Icon

iOS / Guides

Get started integrating Apryse iOS SDK

Welcome to Apryse. This guide will help you integrate a free trial of the Apryse iOS SDK into your Xcode projects for iOS applications. You can either integrate Apryse frameworks automatically using Swift Package Manager, CocoaPods, or install them manually by downloading the SDK. Pick whichever your option you prefer, but integrating with Swift Package Manager is the recommended approach. Your free trial includes unlimited trial usage and support from solution engineers.

Manually integrating iOS PDF library

Prerequisites

  1. Apryse iOS SDK

Download the SDK

Take note of the location of your `PDFNet.dmg` download.
No trial license key required.
The trial of Apryse SDK does not require a trial key. A commercial license key is required for use in a production environment. Please fill out our contact form if you do not have a valid license key.
Keep your license keys confidential.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).

Setup

  1. Create a new Xcode Project. Call it pdfhello. For the purposes of this guide, select a view scene application.

  2. From your PDFNet.dmg download, copy the /Lib/ folder into pdfhello/.

Integrating Apryse SDK for your iOS application

  1. Select the project in the left pane and go to the General tab. Scroll down to find the Embedded Binaries section. Here, add Lib/Tools/Tools.framework and Lib/Framework-dynamic/PDFNet.framework from the Lib/ folder you copied into your project. You can do this by dragging them in from Finder or by clicking the + sign to browse your files.

    General Add Frameworks
  2. Go to the Build Phases tab and click on the + button to add a New Run Script Phase. Copy and paste the following into the shell command:

    bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/PDFNet.framework/strip-framework.sh"

    This will ensure invalid slices are striped from the framework before being submitted to the app store (a longstanding Xcode bug).

    Build Phases Add Script

Add Required Permissions

Apryse uses a select number AppStore permissions to allow certain functionality such as adding image stamps and detecting the Apple Pencil. Your app's plist must include the following keys (with whatever description is appropriate for your app), or it will be rejected from the AppStore.

<key>NSCameraUsageDescription</key>
<string>This will allow you to use the image from your camera.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This will allow you to add images to your photo library.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This will allow you to create signatures and annotations from images in your photo library.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>This will allow us to detect if an Apple Pencil is paired, enabling palm rejection and the ability to scroll with one finger while annotating.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>This will allow us detect if an Apple Pencil is paired, enabling palm rejection and the ability to scroll with one finger while annotating.</string>

Initialize Apryse

Initialize Apryse before you use any Apryse related classes or methods. This only needs to be done once.

The best practice to do this is to use the optional application:willFinishLaunchingWithOptions: method in the AppDelegate class found in either the AppDelegate.swift or AppDelegate.m file in the left pane depending on your choice of language:

// In AppDelegate.swift
import UIKit
import PDFNet
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?
    //... Any methods already here
    func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions:[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        PTPDFNet.initialize("Insert Commercial License Key Here After Purchase")
        return true
    }
}

While you are trialing Apryse, you can pass any string to the initialize method. A string that is not a license key will enable demo mode, where all pages are lightly watermarked.

Next step

View a document

Get the answers you need: Chat with us