Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.5.0, 6.5.3, 6.6.1, 6.6.2, 6.6.3, 6.7.0, 6.7.1, 6.7.2, 6.7.3, 6.8.0
Description
When using FileDialog on iOS and selecting a file from user's iCloud Drive, the dialog fails and shows this error:
Cannot set /private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/example.file as a selected file because it doesn't exist
This is caused by the fact, that QQuickFileDialog checks the file existence before setting it as selected. This works fine for regular files, but for some reason QFileInfo::exists fails for iCloud Drive files,
According to Apple's docs, Qt should call `startAccessingSecurityScopedResource` before using QFileInfo::exists and `stopAccessingSecurityScopedResource` right after it.
I tested it and adding `startAccessingSecurityScopedResource` makes QFileInfo::exists work correctly for iCloud Drive files, and the FileDialog starts working as well
As a side note, I think Qt should provide some wrappers to `startAccessingSecurityScopedResource` and `stopAccessingSecurityScopedResource` functions, because without them the FileDialog on a recent iOS is not very useful
Another side note: Is this check really necessary? How is it possible to select a file which doesn't exist? Is there any platform on which that can happen?
The problematic check is here: https://github.com/qt/qtdeclarative/blob/838b9ee9fe3ad26e5b1fac1616cb575288f4f8a1/src/quickdialogs/quickdialogs/qquickfiledialog.cpp#L167-L168
Attachments
Issue Links
- depends on
-
QTBUG-120528 Support accessing security-scoped URLs on macOS/iOS
- Reported
- is duplicated by
-
QTBUG-119703 FileDialog fails opening iCloud file on iOS
- Closed
- relates to
-
QTBUG-103246 Qt should have a QIo like what KIO is. But much much better
- Open
- links to