Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.4.3, 6.5.2, 6.5.3
-
None
-
developer environment: mac Mini Apple M2, macOS 13.4.1
deployment device: iPad gen. 5, iPadOS 16.5.1
Description
Hello.
I'm trying to read the file content of a file which I want to select using the QFileDialog::getOpenFileUrl() method. I'm using Qt-6.5.3. The code is quite simple:
QUrl url = QFileDialog::getOpenFileUrl(0, caption, dir, filter); qDebug() << "Received URL: " << url; QFile file(url.toLocalFile()); QFileInfo fi(url.toLocalFile()); qDebug() << "File " << url.toLocalFile() << " size: " << file.size() << " exists: " << file.exists(); qDebug() << "FileInfo " << url.toLocalFile() << " size: " << fi.size() << " exists: " << fi.exists();
When compiled with Qt-6.5.3 the code generates the following output:
[DocumentManager] revealDocumentAtURL encountered an error: (null) warning: stale focus object 0x0 , doing manual update (/Users/qt/work/qt/qtbase/src/plugins/platforms/ios/qiosinputcontext.mm:635, virtual void QIOSInputContext::update(Qt::InputMethodQueries)()) debug: Received URL: QUrl("file:///private/var/mobile/Containers/Data/Application/4F4DE0D2-2150-4DFE-902A-48A581B43FE4/Documents/Datovka/Email/9201992/textova-zprava.pdf") debug: File "/private/var/mobile/Containers/Data/Application/4F4DE0D2-2150-4DFE-902A-48A581B43FE4/Documents/Datovka/Email/9201992/textova-zprava.pdf" size: 0 exists: false debug: FileInfo "/private/var/mobile/Containers/Data/Application/4F4DE0D2-2150-4DFE-902A-48A581B43FE4/Documents/Datovka/Email/9201992/textova-zprava.pdf" size: 0 exists: false [DocumentManager] The view service did terminate with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method}
The URL cannot be read in Qt-6.5.
But the code seems to work fine with Qt-5.15:
[DocumentManager] revealDocumentAtURL encountered an error: (null) [DocumentManager] Failed to associate thumbnails for picked URL file:///private/var/mobile/Containers/Data/Application/4F4DE0D2-2150-4DFE-902A-48A581B43FE4/Documents/Datovka/Email/9201992/textova-zprava.pdf with the Inbox copy file:///private/var/mobile/Containers/Data/Application/B056D293-E406-4B68-B693-EF8A30DFB320/tmp/cz.nic.mobile-datovka.testing-Inbox/textova-zprava.pdf: Error Domain=QLThumbnailErrorDomain Code=102 "(null)" UserInfo={NSUnderlyingError=0x281389b90 {Error Domain=GSLibraryErrorDomain Code=3 "Generation not found" UserInfo={NSDescription=Generation not found}}} warning: stale focus object QObject(0x0) , doing manual update (qiosinputcontext.mm:670, virtual void QIOSInputContext::update(Qt::InputMethodQueries)()) debug: Received URL: QUrl("file:///private/var/mobile/Containers/Data/Application/B056D293-E406-4B68-B693-EF8A30DFB320/tmp/cz.nic.mobile-datovka.testing-Inbox/textova-zprava.pdf") debug: File "/private/var/mobile/Containers/Data/Application/B056D293-E406-4B68-B693-EF8A30DFB320/tmp/cz.nic.mobile-datovka.testing-Inbox/textova-zprava.pdf" size: 4344 exists: true debug: FileInfo "/private/var/mobile/Containers/Data/Application/B056D293-E406-4B68-B693-EF8A30DFB320/tmp/cz.nic.mobile-datovka.testing-Inbox/textova-zprava.pdf" size: 4344 exists: true [DocumentManager] The view service did terminate with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method}
Data from the URL can be read in Qt-5.15.
The difference between Qt-6.5 and Qt-5.15 seems to be that 5.15 creates a copy and then passes the URL onto the copy
file:///private/var/mobile/Containers/Data/Application/B056D293-E406-4B68-B693-EF8A30DFB320/tmp/cz.nic.mobile-datovka.testing-Inbox/textova-zprava.pdf
whereas 6.5 passes the URL to the original file
file:///private/var/mobile/Containers/Data/Application/4F4DE0D2-2150-4DFE-902A-48A581B43FE4/Documents/Datovka/Email/9201992/textova-zprava.pdf
.
Is there a bug in Qt-6?
Than you very much for the response.
Attachments
Issue Links
- depends on
-
QTBUG-120528 Support accessing security-scoped URLs on macOS/iOS
- Reported
Gerrit Reviews
For Gerrit Dashboard: QTBUG-117832 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
527335,2 | Fix accessing security scopes URLs in iOS file dialog | dev | qt/qtbase | Status: DEFERRED | 0 | 0 |