PSPDFInstantErrorCode
Objective-C
enum PSPDFInstantErrorCode {}
Swift
typealias InstantError.Code._ErrorType = InstantError
Possible error codes in the PSPDFInstantErrorDomain
.
-
The error is unknown to Instant. The underlying error will be placed in
NSUnderlyingErrorKey
in theuserInfo
.Declaration
Objective-C
PSPDFInstantErrorUnknown = 1
Swift
case unknown = 1
-
The feature you were trying to use is not supported in the context of Instant.
This will, for example, happen when you call
-[PSPDFDocument saveWithOptions:error:]
on documents managed by Instant.Declaration
Objective-C
PSPDFInstantErrorFeatureUnsupported = 2
Swift
case featureUnsupported = 2
-
The document that you were trying to operate on is invalid or unknown to Instant.
Declaration
Objective-C
PSPDFInstantErrorInvalidDocument = 3
Swift
case invalidDocument = 3
-
The JWT you provided to authenticate has been rejected.
This error code is relevant when you are attempting to reauthenticate a document descriptor:
Since the access to a document can be revoked at any time, it is possible that even a freshly obtained JWT is rejected by PSPDFKit Server when you try to reauthenticate that document descriptor. When this happens,-[PSPDFInstantClientDelegate instantClient:documentDescriptor:didFailReauthenticationWithError:]
will be called with this error code onPSPDFInstantClient.delegate
.Note
The layer’s backing storage will not be removed from disk! You can still access and modify that descriptor’seditableDocument
. Any changes you make to it will, however, not be synced anymore until the descriptor has been successfully reauthenticated.Declaration
Objective-C
PSPDFInstantErrorAccessDenied = 4
Swift
case accessDenied = 4
-
Error indicating an attempt was made to download a document that has already been downloaded. The error will have a document descriptor under
PSPDFInstantErrorDocumentDescriptorKey
in the user info.Declaration
Objective-C
PSPDFInstantErrorAlreadyDownloaded = 5
Swift
case alreadyDownloaded = 5
-
Reading from or writing to the annotation database failed.
Whenever possible, the SQLite (extended) error code can be found under the user info key
PSPDFInstantErrorSQLiteExtendedErrorCodeKey
as anNSNumber
.Declaration
Objective-C
PSPDFInstantErrorDatabaseAccessFailed = 6
Swift
case databaseAccessFailed = 6
-
Writing a PDF or metadata file to disk failed.
Note
This does not refer to database errors: Those will be reported withPSPDFInstantErrorDatabaseAccessFailed
, with an appropriate SQLite extended error code.
Instead, this error code is relevant for downloading documents.Declaration
Objective-C
PSPDFInstantErrorCouldNotWriteToDisk = 7
Swift
case couldNotWriteToDisk = 7
-
The URL you have used is invalid for this purpose.
Declaration
Objective-C
PSPDFInstantErrorInvalidURL = 8
Swift
case invalidURL = 8
-
Error returned when an attempt is made to save a document managed by Instant. The error will have a document under
PSPDFInstantErrorDocumentKey
in the user info.Declaration
Objective-C
PSPDFInstantErrorSavingDisabled = 9
Swift
case savingDisabled = 9
-
Error returned when the document passed into
-[PSPDFInstantDocumentDescriptor annotationWithIdentifier:forDocument:error]
is not managed by the receiver.Declaration
Objective-C
PSPDFInstantErrorUnmanagedDocument = 10
Swift
case unmanagedDocument = 10
-
Error returned when the receiver does not know of an annotation for the identifier passed into
-[PSPDFInstantDocumentDescriptor annotationWithIdentifier:forDocument:error]
.Declaration
Objective-C
PSPDFInstantErrorNoSuchAnnotation = 11
Swift
case noSuchAnnotation = 11
-
Error returned when the annotation passed into
-[PSPDFInstantDocumentDescriptor identifierForAnnotation:error:]
is not managed by the receiver.Declaration
Objective-C
PSPDFInstantErrorUnmanagedAnnotation = 12
Swift
case unmanagedAnnotation = 12
-
Retrieving an item from the disk cache failed.
This can happen if the disk cache is modified by other means than Instant’s public API. Although less likely, this can also be caused by a defect of the disk itself.
Declaration
Objective-C
PSPDFInstantErrorCouldNotReadFromDiskCache = 13
Swift
case couldNotReadFromDiskCache = 13
-
Removing an item from the disk cache filed.
This can happen if the disk cache is modified by other means than Instant’s public API. Although less likely, this can also be caused by a defect of the disk itself.
Declaration
Objective-C
PSPDFInstantErrorCouldNotRemoveDiskCacheEntries = 14
Swift
case couldNotRemoveDiskCacheEntries = 14
-
The operation could not be completed because the network request failed. This happens when offline.
If you were syncing manually, retry at a later date. If you are using automatic synchronization via
PSPDFInstantDocumentDescriptor.delayForSyncingLocalChanges
,-[PSPDFInstantDocumentDescriptor startListeningForServerChanges]
, orPSPDFInstantViewController.shouldListenForServerChangesWhenVisible
, there is not much for you to do: a re-attempt to sync will be scheduled at an appropriate time.
However, you may still want to inform your users, that their local changes are not synced, though.Declaration
Objective-C
PSPDFInstantErrorRequestFailed = 16
Swift
case requestFailed = 16
-
The operation could not be completed because the server sent invalid data.
If you ever see this error, please contact support.
Declaration
Objective-C
PSPDFInstantErrorInvalidServerData = 17
Swift
case invalidServerData = 17
-
The operation could not be completed because the server rejected the request as invalid.
If you ever see this error, please contact support.
Declaration
Objective-C
PSPDFInstantErrorInvalidRequest = 18
Swift
case invalidRequest = 18
-
The operation could not be completed because the size of the payload sent to server is too large.
Declaration
Objective-C
PSPDFInstantErrorPayloadLimitExceeded = 19
Swift
case payloadLimitExceeded = 19
-
The operation could not be completed because the client and server have incompatible versions: the server expects a newer client.
You need to update this framework in your app to a compatible version and release an update. If a user sees this on their device they need to update your app.
In the default setting,
PSPDFInstantViewController.shouldShowCriticalErrors
causes an alert to be shown to the user when this error is encountered, saying that an app update is needed.
If you have your own error handling for this situation you can safely set that property tofalse
.Declaration
Objective-C
PSPDFInstantErrorOldClient = 21
Swift
case oldClient = 21
-
The operation could not be completed because the client and server have incompatible versions: the client is too new for the server.
The server needs to be updated to a compatible version. You should update your server before releasing the updated client to ensure this error is never encountered on users’ devices.
Declaration
Objective-C
PSPDFInstantErrorOldServer = 22
Swift
case oldServer = 22
-
The JWT you specified has an invalid format.
Instant performs limited offline validation of the strings that you pass into methods that require a JWT before even contacting the server. JWTs must…
- consist of a header, payload, and signature part,
- the payload needs to be a base64 URL encoded JSON object,
- which — at the very least — needs to contain a string for the key
document_id
.
The string you provided either violates at least one of these rules, or contains invalid data for an optional claim — such as
layer_name
oruser_id
. For details, please inspect thelocalizedDescription
.Declaration
Objective-C
PSPDFInstantErrorInvalidJWT = 32
Swift
case invalidJWT = 32
-
The specified user ID is incompatible with the value stored on disk.
To prevent data corruption, Instant verifies that you do not inadvertently “switch out” the user for a document descriptor. If the JWT you used to download a layer contained the
user_id
claim, that value is stored on disk. Whenever you attempt to reauthenticate the document descriptor, Instant then compares the stored value to the value encoded in the new JWT, and will fail with this error if the values do not match up.Declaration
Objective-C
PSPDFInstantErrorUserIDMismatch = 33
Swift
case userIDMismatch = 33
-
An attachment with the given ID does not exist in the disk cache.
To find out whether or not the attachment actually exists, try downloading it from the server.
Declaration
Objective-C
PSPDFInstantErrorAttachmentNotLoaded = 40
Swift
case attachmentNotLoaded = 40
-
There is no attachment with the specified ID.
A download request for the attachment with the given ID has been rejected by the server because it does not know of such an attachment.
Declaration
Objective-C
PSPDFInstantErrorNoSuchAttachment = 41
Swift
case noSuchAttachment = 41
-
An error occurred trying to create the attachment for an annotation.
The affected annotation can be found under
PSPDFInstantErrorAnnotationKey
.Declaration
Objective-C
PSPDFInstantErrorCouldNotCreateAttachment = 42
Swift
case couldNotCreateAttachment = 42
-
The operation cannot be performed at this time, because the document descriptor is busy authenticating.
You will encounter this error code when you are attempting to reauthenticate or sync a document descriptor that is already in the process of authenticating. The
userInfo
of error objects with this code will contain the document descriptor in question under thePSPDFInstantErrorDocumentDescriptorKey
.Declaration
Objective-C
PSPDFInstantErrorAlreadyAuthenticating = 0x42
Swift
case alreadyAuthenticating = 66
-
The operation cannot be performed at this time because the datastore for this document descriptor requires a content migration.
You can encounter this error when you attempt to sync a
PSPDFInstantDocumentDescriptor
before asking it for aDocument
, after an update of the Instant framework that requires a deep content migration. (Instant performs simple migrations automatically.) The first such update was Instant 8.5.2 for iOS.The necessary content migration can be triggered in one of the following ways:
- implicitly: asking the document descriptor for a
Document
will start the migration - explicitly: calling
-[<PSPDFInstantDocumentDescriptor> attemptContentMigration:]
will attempt to start a new migration — if it is not in progress already.
The
userInfo
of error objects with this code will contain the document descriptor in question under thePSPDFInstantErrorDocumentDescriptorKey
.Declaration
Objective-C
PSPDFInstantErrorContentMigrationNeeded = 0x60
Swift
case contentMigrationNeeded = 96
- implicitly: asking the document descriptor for a
-
The operation cannot be performed at this time because the datastore for this document descriptor is in the middle of a content migration.
The most likely cause for this error is repeatedly calling
-[<PSPDFInstantDocumentDescriptor> attemptContentMigration:]
. You can, however, also run into this situation when attempting to explicitly sync a document descriptor that is currently performing a content migration. To recover from this error, you should generally just wait.The
userInfo
of error objects with this code will contain the document descriptor in question under thePSPDFInstantErrorDocumentDescriptorKey
.Declaration
Objective-C
PSPDFInstantErrorPerformingContentMigration = 0x61
Swift
case performingContentMigration = 97