PSPDFInstantDocumentState

enum PSPDFInstantDocumentState {}

Lists the observable states of an Instant document descriptor and its sync cycle.

The term “sync cycle” refers to the repetitive transitions between the states “receiving changes” and “sending changes” until there are no unsynced local changes remaining, and the document becomes “clean”. If you are using automatic sync, a sync cycle will begin PSPDFInstantDocumentDescriptor.delayForSyncingLocalChanges seconds after the last change to an annotation in the document. When listening for server changes, a sync cycle can additionally be triggered by changes coming in from the server even before that interval has elapsed.
When not listening for server changes and with automatic sync of local changes disabled, a sync cycle starts whenever you call -[PSPDFInstantDocumentDescriptor sync].

PSPDFInstantDidFinishSyncingNotification is posted whenever a sync cycle completes successfully. If the cycle fails, PSPDFInstantDidFailSyncingNotification is posted instead.

Note

The states gathered and exposed in this enum have been preselected for relevance to an end user. If you find that you cannot provide the kind of feedback you need to the users of your app, please contact us via https://pspdfkit.com/support/request/
  • The state of the document descriptor has not been determined yet.

    The state will be determined the first time you obtain a document from a downloaded document descriptor.

    Declaration

    Objective-C

    PSPDFInstantDocumentStateUnknown

    Swift

    case unknown = 0
  • The document descriptor does not have any local changes.

    If you are listening for server changes — as PSPDFInstantViewController does in its default configuration when visible — this also implies that you have the latest observable changes from the server.

    Declaration

    Objective-C

    PSPDFInstantDocumentStateClean

    Swift

    case clean = 1
  • The document descriptor has local changes that have not been synced to the server.

    If you use automatic syncing, (either through PSPDFInstantDocumentDescriptor.delayForSyncingLocalChanges or by listening for server changes) your changes will be sent to the server during the next sync cycle. If you have disabled automatic syncing, calling -[PSPDFInstantDocumentDescriptor sync] will start a sync cycle to get all your local changes to the server and fetch the newest updates from it.

    Declaration

    Objective-C

    PSPDFInstantDocumentStateDirty

    Swift

    case dirty = 2
  • The document descriptor is busy syncing — currently sending its local changes to the server.

    Should communication with the server fail, the document descriptor will fall back into state “dirty”. If all goes well, it will transition to “receiving changes”.

    Declaration

    Objective-C

    PSPDFInstantDocumentStateSendingChanges

    Swift

    case sendingChanges = 3
  • The document descriptor is busy syncing — currently receiving changes from the server.

    Should communication with the server fail the document descriptor will fall back into the “dirty” or “clean” state — depending on whether or not there are unsynced changes. If all goes well, it will transition to either the “clean” or the “sending changes” state — depending on whether new local changes have accumulated during the transmission.

    This repeated back and forth between the “sending changes” and “receiving changes” state is what we call the sync cycle. It starts when a sync request is made, and — if all goes well — ends when there are no local changes left.

    Declaration

    Objective-C

    PSPDFInstantDocumentStateReceivingChanges

    Swift

    case receivingChanges = 4
  • The document descriptor is invalid and cannot be used any longer.

    You may want to remove its local storage, but that‘s about all you can do with it.

    Declaration

    Objective-C

    PSPDFInstantDocumentStateInvalid

    Swift

    case invalid = 5