PSPDFKit 4 iOS Migration Guide - Seamless Upgrade Instructions
PSPDFKit 4 for iOS is a major new release and includes many new features and a few breaking changes. It’s the first release that was rethought from the ground up with iOS 8 in mind (backward compatible to iOS 7), and we were able to redesign many aspects that were suboptimal in PSPDFKit 3 for iOS due to the iOS 5/6 requirement.
Requirements
Starting with PSPDFKit 4.0, you’ll need iOS 7.0 upward and Xcode 6.0 (SDK 8) to compile. Your apps can be written in Objective-C or Swift.
We also require UIViewControllerBasedStatusBarAppearance
to be set to YES
. This is the default behavior for any app beginning with iOS 7. However, Apple lets you customize this behavior. PSPDFKit v3 supported both modes of operation, but since the view controller-based status bar appearance clearly is the future, we’ll focus on that.
License
The PSPDFKit 4 demo now requires a license both for the demo and for the licensed versions. This change was made in response to people having issues entering the license key. Use our website to obtain a demo key while you’re evaluating. If you’re just testing PSPDFKit Catalog, no custom keys are required.
PSPDFDocument
The document model in 4.0 is now immutable for data sources. This allows faster internal code handling. If you need to change your data sources for your document, create a new document using the documentByAppendingObjects:
helper that will accept NSString
, NSData
, or a CGDataProviderRef
.
PSPDFViewController
We modernized the view controller API and removed several properties that were no longer in line with iOS 7: tintColor
, shouldTintPopovers
, transparentHUD
, and minLeft/RightToolbarWidth
. Use UIAppearance
to customize colors and tint throughout PSPDFKit. See our appearance styling guide for details.
Most properties, including the overrideClass:withClass:
method, have been moved to the new PSPDFConfiguration
object, which better defines when configuration changes should be done and also allows you to archive/export complete configuration sets. See PSPDFKit Catalog for examples of how to use PSPDFConfiguration
.
The setUpdateSettingsForRotationBlock:
method has been replaced with the more generic setUpdateSettingsForBoundsChangeBlock:
. Ask the PSPDFViewController
to get the current interface rotation.
Status Bar
The status bar is now managed by view controllers, and as such, by your UINavigationController
subclass. As a result, we completely deleted PSPDFStatusBarStyle
and the matching statusBarStyleSetting
property. This is now controlled by the navigation bar style set in your UINavigationController
. We added a new property, shouldHideStatusBar
, to the PSPDFViewController
; this property controls the status bar appearance globally in all used view controllers as a convenience method for you.
Annotation Toolbar
The old PSPDFAnnotationToolbar
has been removed in favor of the more modern and flexible PSPDFFlexibleAnnotationToolbar
that we introduced in PSPDFKit 3.6 for iOS. To simplify things, we renamed this new modern toolbar to PSPDFAnnotationToolbar
. You’ll have to update your code if you used a subclass of the old class.
Digital Signing Architecture
We updated the signing architecture to allow signing using PKI hardware and to allow removing signatures. Many internal classes have been updated and improved.
Data Model
We made various changes to the way annotations and other data are now archived via NSKeyedArchiver
. PSPDFKit is downward compatible and can read its own format starting with version 3.0. Make sure older installations don’t try to parse the PSPDFKit 4 data format, as they’ll lose certain information from the PSPDFKit 4 data format.
Various Other Changes
PSPDFURLConnection
has been completely removed in favor of NSURLSession
. If your code was using this internal class, update your calls or use something like AFNetworking
instead.
PSPDFIndexSetFromArray()
has been replaced by a category in PSPDFKit Catalog. See NSArray+PSCIndexSet.h
.
Many classes now work independently of PSPDFViewController
. A new PSPDFPresentationContext
protocol has been introduced; it defines a subset of PSPDFViewController
to make these internal components reusable.