Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
iOS file access permission
I'm trying to access files in the downloads folder on iOS for both reading and writing. My application does this successfully on Android, but on iOS permission is not being granted. I added
NSDownloadsFolderUsageDescriptionto the info.plist file, which according to the apple developer site should do the trick (https://developer.apple.com/documentation/bundleresources/information_property_list/nsdownloadsfolderusagedescription). But it's still not working for me.
On android I had to add some extra code to explicitly trigger the app to request permission. Do I need to do the same on iOS?
IIRC, you may have to add an entitlement to your app. See here.
hmm, I added that to my info.plist and it didn't help.
I'm not sure how the iOS filesystem works. I don't see a downloads folder on my iPad like I have on my android phone and my windows PC. I do see that some of the other apps on my iPad have their own data folders that I can browse using finder. Also, my app never asks me to grant permission to access the downloads folder.
In case it helps, my app uses QStandardPaths to choose the location. On iOS, I have success with opening files using QStandardPaths::AppDataLocation but not with QStandardPaths::DownloadLocation (both of these worked fine on android).
iOS security model is not the same as Android and it does not expose the system's ressources in the same manner.
Did you check the entitlements in Xcode ?
I don't see any security, sandbox mode, or other file-related things in the capabilities menu, which as far as I can tell is where entitlements are in xcode now for iOS.
macOS and iOS are two different beasts. I think you should take a look at this:
Before seeing this reply, I figured out that the reason it wasn't working is because the downloads folder at the path that came form QStandardPaths didn't exist. Now my app can read and write those files. However, I can't find it through the iPad browser or when I try to browse on my mac. I think that I can't find it because the the path I'm using now from QStandardPaths is part of the app's sandbox.
Anyway, I'll have to implement a file dialog to try your solution. Would QFileDialog do the trick?
QFileDialog uses the system dialog by default on systems that provide one. I am currently unsure that it will fit your use case but I haven't used it directly on iOS for a long time.
@SGaist well FileDialog doesn't seem to do the trick, I'm still restricted to the app's sandbox. I really have no idea how to implement the objective-C controller in QT. Any suggestions?
Did you already do Objective-C++ ?