PSPDFDocumentCheckpointer

Objective-C


@interface PSPDFDocumentCheckpointer : NSObject

Swift

class DocumentCheckpointer : NSObject

A checkpointer handles autosaving of annotations for recovery in case of a crash that occurs without saving. A checkpoint is a small file that contains all the changes made to the document that haven’t been saved. The checkpoint is created according to the strategy. On a save of the document, it is automatically deleted.

Note

Checkpoints are not supported for multi-provider Documents, or documents that are encrypted.

Note

This class is thread safe.

Note

You must not create instances of this class yourself, and instead use the checkpointer property on Document.
  • Unavailable

    Not the designated initializer

    Undocumented

    Declaration

    Objective-C

    PSPDF_EMPTY_INIT_UNAVAILABLE
  • Unavailable

    Not the designated initializer

    Undocumented

    Declaration

    Objective-C

    PSPDF_EMPTY_INIT_UNAVAILABLE
  • The mode in which checkpointing should be performed. Defaults to PSPDFDocumentCheckpointingStrategyManual.

    Declaration

    Objective-C

    @property (nonatomic) PSPDFDocumentCheckpointingStrategy strategy;

    Swift

    var strategy: DocumentCheckpointingStrategy { get set }
  • The document for which the receiver is created.

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) PSPDFDocument *_Nullable document;

    Swift

    weak var document: PSPDFDocument? { get }
  • true if a checkpoint file is available at checkpointLocation, else false.

    Warning

    This property performs disk I/O every time it is called.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL checkpointExists;

    Swift

    var checkpointExists: Bool { get }
  • Call this method to save a checkpoint of the document’s dirty objects. Any previous checkpoint will be deleted.

    Declaration

    Objective-C

    - (void)saveCheckpointWithCompletionHandler:
        (void (^_Nullable)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func saveCheckpoint(completionHandler: ((Bool, Error?) -> Void)? = nil)

    Parameters

    completionHandler

    The block to call after the checkpoint is saved. It is passed in true if the save completed successfully, or there was nothing to save, else false is passed in. If additional info about the failure is available, error, is passed in with that information. Always called on the main queue.

  • Deletes the checkpoint file, if it exists.

    Declaration

    Objective-C

    - (void)deleteCheckpointWithCompletionHandler:
        (void (^_Nullable)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func deleteCheckpoint(completionHandler: ((Bool, Error?) -> Void)? = nil)

    Parameters

    completionHandler

    The block to call after the checkpoint is deleted. true if the checkpoint was successfully deleted or one doesn’t exist, else false. If additional info about the failure is available, error, is passed in with that information. Always called on the main queue.