PSPDFFileManager

@protocol PSPDFFileManager <NSObject>

Wraps file system calls. Internal class cluster. Can be replaced with Enterprise SDK wrappers like Good Technology or MobileIron AppConnect.

  • If YES, then we can’t use certain more optimized methods like UIGraphicsBeginPDFContextToFile since they would use write methods that we can’t override.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL usesEncryption;

    Swift

    var usesEncryption: Int32 { get }
  • We query the file manager for exceptions where we require unencrypted files on disk. This method expects to return YES for any type if usesEncryption returns NO. Various features in PSPDFKit require unencrypted files while usage (Open In, QuickLook, Audio Recording)

    Declaration

    Objective-C

    - (BOOL)allowsPolicyEvent:(nonnull NSString *)policyEvent;

    Swift

    func allowsPolicyEvent(_ policyEvent: Any!) -> Any!
  • Copies a file to an unencrypted location if the security check passes.

    Declaration

    Objective-C

    - (nullable NSURL *)
    copyFileToUnencryptedLocationIfRequired:(nullable NSURL *)fileURL
                                policyEvent:(nonnull NSString *)policyEvent
                                      error:(NSError *_Nullable *_Nullable)error;

    Swift

    func copyFile(toUnencryptedLocationIfRequired fileURL: Any!, policyEvent: Any!, error: Any!) -> Any!
  • Cleans up a temporary file. Searches both in encrypted store (if encrypted) and default disk store.

    Declaration

    Objective-C

    - (BOOL)cleanupIfTemporaryFile:(nonnull NSURL *)URL;

    Swift

    func cleanupIfTemporaryFile(_ URL: Any!) -> Any!
  • This method creates a data provider pointing to temporary data storage that is writable. Especially when processing documents, it might be necessary to create temporary files and using this, you can secure the temporary files however you like. By default, this creates a PSPDFFileDataProvider pointing to a temporary file.

    Declaration

    Objective-C

    - (nullable id<PSPDFDataProviding>)
    createTemporaryWritableDataProviderWithPrefix:(nullable NSString *)prefix;
  • Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull libraryDirectory;

    Swift

    var libraryDirectory: UnsafeMutablePointer<Int32>! { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *applicationSupportDirectory

    Swift

    var applicationSupportDirectory: UnsafeMutablePointer<Int32>! { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *cachesDirectory

    Swift

    var cachesDirectory: UnsafeMutablePointer<Int32>! { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *documentDirectory

    Swift

    var documentDirectory: UnsafeMutablePointer<Int32>! { get }
  • Undocumented

    Declaration

    Objective-C

    - (NSString *)temporaryDirectoryWithUID:(nullable NSString *)UID;

    Swift

    func temporaryDirectory(withUID UID: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (nullable NSString *)unencryptedTemporaryDirectoryWithUID:(nullable NSString *)UID;

    Swift

    func unencryptedTemporaryDirectory(withUID UID: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isNativePath:(nullable NSString *)path;

    Swift

    func isNativePath(_ path: Any!) -> Any!
  • Declaration

    Objective-C

    - (BOOL)fileExistsAtPath:(nullable NSString *)path;

    Swift

    func fileExists(atPath path: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)fileExistsAtPath:(nullable NSString *)path isDirectory:(nullable BOOL *)isDirectory;

    Swift

    func fileExists(atPath path: Any!, isDirectory: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)fileExistsAtURL:(nullable NSURL *)url;

    Swift

    func fileExists(atURL url: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)fileExistsAtURL:(nullable NSURL *)url isDirectory:(nullable BOOL *)isDirectory;

    Swift

    func fileExists(atURL url: Any!, isDirectory: Any!) -> Any!
  • Declaration

    Objective-C

    - (BOOL)createFileAtPath:(nonnull NSString *)path
                    contents:(nullable NSData *)data
                  attributes:(nullable NSDictionary<NSString *, id> *)attributes;

    Swift

    func createFile(atPath path: Any!, contents data: Any!, attributes: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(nullable NSDictionary<NSString *, id> *)attributes error:(NSError **)error;

    Swift

    func createDirectory(atPath path: Any!, withIntermediateDirectories createIntermediates: Any!, attributes: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)createDirectoryAtURL:(NSURL *)url withIntermediateDirectories:(BOOL)createIntermediates attributes:(nullable NSDictionary<NSString *, id> *)attributes error:(NSError **)error;

    Swift

    func createDirectory(atURL url: Any!, withIntermediateDirectories createIntermediates: Any!, attributes: Any!, error: Any!) -> Any!
  • Declaration

    Objective-C

    - (BOOL)writeData:(nonnull NSData *)data
               toFile:(nonnull NSString *)path
              options:(NSDataWritingOptions)writeOptionsMask
                error:(NSError *_Nullable *_Nullable)error;

    Swift

    func writeData(_ data: Any!, toFile path: Any!, options writeOptionsMask: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)writeData:(NSData *)data toURL:(NSURL *)fileURL options:(NSDataWritingOptions)writeOptionsMask error:(NSError **)error;

    Swift

    func writeData(_ data: Any!, toURL fileURL: Any!, options writeOptionsMask: Any!, error: Any!) -> Any!
  • Declaration

    Objective-C

    - (nullable NSData *)
    dataWithContentsOfFile:(nonnull NSString *)path
                   options:(NSDataReadingOptions)readOptionsMask
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func data(withContentsOfFile path: Any!, options readOptionsMask: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (nullable NSData *)dataWithContentsOfURL:(NSURL *)fileURL options:(NSDataReadingOptions)readOptionsMask error:(NSError **)error;

    Swift

    func data(withContentsOfURL fileURL: Any!, options readOptionsMask: Any!, error: Any!) -> Any!
  • Declaration

    Objective-C

    - (BOOL)copyItemAtURL:(nonnull NSURL *)sourceURL
                    toURL:(nonnull NSURL *)destinationURL
                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    func copyItem(atURL sourceURL: Any!, toURL destinationURL: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError **)error;

    Swift

    func moveItem(atURL sourceURL: Any!, toURL destinationURL: Any!, error: Any!) -> Any!
  • Declaration

    Objective-C

    - (BOOL)replaceItemAtURL:(nonnull NSURL *)originalItemURL
               withItemAtURL:(nonnull NSURL *)newItemURL
              backupItemName:(nullable NSString *)backupItemName
                     options:(NSFileManagerItemReplacementOptions)options
            resultingItemURL:(NSURL *_Nullable *_Nullable)resultingURL
                       error:(NSError *_Nullable *_Nullable)error;

    Swift

    func replaceItem(atURL originalItemURL: Any!, withItemAtURL newItemURL: Any!, backupItemName: Any!, options: Any!, resultingItemURL resultingURL: Any!, error: Any!) -> Any!
  • Declaration

    Objective-C

    - (BOOL)removeItemAtPath:(nonnull NSString *)path
                       error:(NSError *_Nullable *_Nullable)error;

    Swift

    func removeItem(atPath path: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)removeItemAtURL:(NSURL *)URL error:(NSError **)error;

    Swift

    func removeItem(atURL URL: Any!, error: Any!) -> Any!
  • Declaration

    Objective-C

    - (nullable NSDictionary<NSString *, id> *)
    attributesOfFileSystemForPath:(nonnull NSString *)path
                            error:(NSError *_Nullable *_Nullable)error;

    Swift

    func attributesOfFileSystem(forPath path: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (nullable NSDictionary<NSString *, id> *)attributesOfItemAtPath:(nullable NSString *)path error:(NSError **)error;

    Swift

    func attributesOfItem(atPath path: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isDeletableFileAtPath:(NSString *)path;

    Swift

    func isDeletableFile(atPath path: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isWritableFileAtPath:(NSString *)path;

    Swift

    func isWritableFile(atPath path: Any!) -> Any!
  • Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)
    contentsOfDirectoryAtPath:(nonnull NSString *)path
                        error:(NSError *_Nullable *_Nullable)error;

    Swift

    func contentsOfDirectory(atPath path: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (NSArray<NSString *> *)subpathsOfDirectoryAtPath:(NSString *)path error:(NSError **)error;

    Swift

    func subpathsOfDirectory(atPath path: Any!, error: Any!) -> Any!
  • Declaration

    Objective-C

    - (nonnull NSDirectoryEnumerator<NSString *> *)enumeratorAtPath:
        (nonnull NSString *)path;

    Swift

    func enumerator(atPath path: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (NSDirectoryEnumerator<NSURL *> *)enumeratorAtURL:(NSURL *)url includingPropertiesForKeys:(NSArray<NSString *> *)keys options:(NSDirectoryEnumerationOptions)mask errorHandler:(nullable BOOL (^)(NSURL *url, NSError *error))handler;

    Swift

    func enumerator(atURL url: Any!, includingPropertiesForKeys keys: Any!, options mask: Any!, errorHandler handler: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (NSString *)destinationOfSymbolicLinkAtPath:(NSString *)path error:(NSError **)error;

    Swift

    func destinationOfSymbolicLink(atPath path: Any!, error: Any!) -> Any!
  • Returns the absolute path as C string.

    Declaration

    Objective-C

    - (nonnull const char *)fileSystemRepresentationForPath:
        (nonnull NSString *)path;

    Swift

    func fileSystemRepresentation(forPath path: Any!) -> UnsafePointer<Int8>!
  • Declaration

    Objective-C

    - (BOOL)fileHandleForReadingFromURL:(nonnull NSURL *)url
                                  error:(NSError *_Nullable *_Nullable)error
                              withBlock:
                                  (nonnull BOOL (^)(NSFileHandle *_Nonnull))reader;

    Swift

    func fileHandleForReading(fromURL url: Any!, error: Any!, withBlock reader: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)fileHandleForWritingToURL:(NSURL *)url error:(NSError **)error withBlock:(BOOL (^)(NSFileHandle *))writer;

    Swift

    func fileHandleForWriting(toURL url: Any!, error: Any!, withBlock writer: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)fileHandleForUpdatingURL:(NSURL *)url error:(NSError **)error withBlock:(BOOL (^)(NSFileHandle *))updater;

    Swift

    func fileHandle(forUpdatingURL url: Any!, error: Any!, withBlock updater: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)setUbiquitous:(BOOL)flag itemAtURL:(NSURL *)url destinationURL:(NSURL *)destinationURL error:(NSError **)error;

    Swift

    func setUbiquitous(_ flag: Any!, itemAtURL url: Any!, destinationURL: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isUbiquitousItemAtURL:(NSURL *)url;

    Swift

    func isUbiquitousItem(atURL url: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)startDownloadingUbiquitousItemAtURL:(NSURL *)url error:(NSError **)error;

    Swift

    func startDownloadingUbiquitousItem(atURL url: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)evictUbiquitousItemAtURL:(NSURL *)url error:(NSError **)error;

    Swift

    func evictUbiquitousItem(atURL url: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (nullable NSURL *)URLForUbiquityContainerIdentifier:(nullable NSString *)containerIdentifier;

    Swift

    func url(forUbiquityContainerIdentifier containerIdentifier: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (nullable NSURL *)URLForPublishingUbiquitousItemAtURL:(NSURL *)url expirationDate:(NSDate *_Nullable *_Nullable)outDate error:(NSError **)error;

    Swift

    func urlForPublishingUbiquitousItem(atURL url: Any!, expirationDate outDate: Any!, error: Any!) -> Any!
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, readonly, copy) id<NSObject, NSCopying, NSCoding> ubiquityIdentityToken

    Swift

    var ubiquityIdentityToken: Any? { get }
  • If the file manager is coordinated, this will temporarily disable coordination for more control.

    Declaration

    Objective-C

    - (void)performBlockWithoutCoordination:(nonnull void (^)(void))block;

    Swift

    func performBlockWithoutCoordination(_ block: (() -> Void)!)