[SOLVED] Accessing iOS Photo Folder
-
Using Qt5.3
I know most of the folders for an App are sandboxed on iOS, however is it possible to get to the users photo folder? I want to give them the possibility of choosing a photo out of the camera roll.
-
You cannot directly using the Qt API, you have to use a iOS native API:
You can easily mix C++ and objective-C code in a Qt project simply adding a '.mm' source file.
In .pro file:
@
OBJECTIVE_SOURCE += mysource.mm
@and inside the .mm you can mix C++ with objective-C code like that:
@
void MyQtObjectClass::someMethod() {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
... etc
}}
@
-
OK, that gives me something to work with. Will take a good look.
So would the code above give me direct access to the folder, so I can read the files?
Does anybody have any good examples of this?
Thanks.
-
On iOS you never get a direct access of things outside your app.
There is always an API that pass the control to iOS system and return to you with a result from the user.
In the case of UIImagePickerController, when you launch it, it will appear to the user a new screen (under the iOS control) where the user navigate and choose the picture and after that your app get only the image user chosen.
This is what I know.For examples, try to look in the iOS documentation and tutorial there are a lot of examples.
-
Thank you for that. That makes a lot more sense now.