PSPDFDocumentCheckpointer


@interface PSPDFDocumentCheckpointer : 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 PSPDFDocuments, 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 PSPDFDocument.
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFDocumentCheckpointer : NSObject
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFDocumentCheckpointer : NSObject
  • The mode in which checkpointing should be performed. Defaults to PSPDFDocumentCheckpointingStrategyManual.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        PSPDFDocumentCheckpointingStrategy strategy;

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Warning

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

    Declaration

    Objective-C

    @property (readonly, nonatomic) 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 YES if the save completed successfully, or there was nothing to save, else NO 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. YES if the checkpoint was successfully deleted or one doesn’t exist, else NO. If additional info about the failure is available, error, is passed in with that information. Always called on the main queue.