Related to this.
When I open a file using QLPreviewController
, and press the "Share" button, the console prints the following logs:
[cloudthumbnails.generation] Unable to determine whether file:///Users/xxxxxx/Library/Developer/CoreSimulator/Devices/XXXXXX/data/Containers/Data/Application/XXXXXX/Documents/xxxxxx.pdf is a directory: Error Domain=NSCocoaErrorDomain Code=260
[ShareSheet] Failed to request default share mode for fileURL:file:///Users/xxxxxx/Library/Developer/CoreSimulator/Devices/XXXXXX/data/Containers/Data/Application/XXXXXX/Documents/xxxxxx.pdf
[ShareSheet] Only support loading options for CKShare and SWY types.
[ShareSheet] error fetching item for URL:file:///Users/xxxxxx/Library/Developer/CoreSimulator/Devices/XXXXXX/data/Containers/Data/Application/XXXXXX/Documents/xxxxxx.pdf
[ShareSheet] error loading metadata for documentURL:file:///Users/xxxxxx/Library/Developer/CoreSimulator/Devices/XXXXXX/data/Containers/Data/Application/XXXXXX/Documents/xxxxxx.pdf
But, the path is correct (in the app's Documents folder), and the file can be opened and shared successfully by any means: save on my Documents, Gmail, AirDrop, Slack, etc.
Then, why all these errors? I believe the following crash I am receiving on Firebase Crashlytics may be related:
-[UIDocumentPickerViewController initForExportingURLs:asCopy:] must be called with a URL pointing to an existing file: Error Domain=NSCocoaErrorDomain Code=260 UserInfo (NSURL=file:///var/mobile/Containers/Data/Application/APP_ID/Documents/FILE.pdf, NSFilePath=/var/mobile/Containers/Data/Application/APP/ Documents/FILE.pdf, (Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"))
Because I am not calling [UIDocumentPickerViewController initForExportingURLs:asCopy:]
elsewhere in the app. The only way that method gets called is by sharing a file from the app and storing it in the iPhone file system.