Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access iOS Photo Library #34007

Open
HEAVYPOLY opened this issue Nov 29, 2019 · 11 comments
Open

Unable to access iOS Photo Library #34007

HEAVYPOLY opened this issue Nov 29, 2019 · 11 comments

Comments

@HEAVYPOLY
Copy link
Contributor

HEAVYPOLY commented Nov 29, 2019

Godot version:
3.2 Beta 2
OS/device including version:
Pop OS 19.1
Issue description:
Unable to access iOS Photo Library

Steps to reproduce:

in iOS export settings, add a PhotoLibrary usage description
Screenshot from 2019-11-29 14-19-11

OS.request_permissions()
OS.get_system_dir(6) for user photos directory (same code works with android and desktop)

I have also tried using
'/private/var/mobile/Media/DCIM'

When I open a file dialog with that path, I get this path instead:
'/private/var/mobile/Containers/Data/Application/.......'

YLUpl21D
Minimal reproduction project:

@bruvzg
Copy link
Member

bruvzg commented Dec 2, 2019

Neither OS.request_permissions nor OS.get_system_dir is implemented on iOS.

@bruvzg
Copy link
Member

bruvzg commented Dec 2, 2019

I'm not sure if it's at all possible to access Photo library as filesystem, there's PhotoKit API for this (which is not used by Godot).

@HEAVYPOLY
Copy link
Contributor Author

HEAVYPOLY commented Dec 2, 2019

Ok, thanks for the clarification. Is there a way to read / write to external storage? I'd be fine with documents or wherever, doesn't have to be photos.

@bruvzg
Copy link
Member

bruvzg commented Dec 2, 2019

Is there a way to read / write to external storage? I'd be fine with documents or wherever, doesn't have to be photos.

Add Support opening documents in place (LSSupportsOpeningDocumentsInPlace) = YES and Application that supports iTunes sharing (UIFileSharingEnabled) = YES to the {name}-Info.plist in the Xcode project.

Screenshot 2019-12-02 at 19 47 58

And write/read your files to the user://Documents/ (create directory first, it won't be there for newly installed app).

Files should be available in macOS Finder/iTunes share (when connected via USB), and Files app on the device.

@HEAVYPOLY
Copy link
Contributor Author

Thank you!! I've been searching for this for months, trying it now!

@HEAVYPOLY
Copy link
Contributor Author

It worked! I can see the files in Files app on iOS. I'm still having trouble using godot's file dialog though. I'm using the same path (user://exports) but godot file dialog doesn't see it. It goes to /private/var/mobile/Containers/Data/Application/... instead. Is there a way to get file dialog working? Or a way to use iOS native file dialog

@bruvzg
Copy link
Member

bruvzg commented Dec 2, 2019

There's access property in the file dialog, set it to User Data to restrict it to user://...

Screenshot 2019-12-02 at 22 02 19

@HEAVYPOLY
Copy link
Contributor Author

Ah! right. I had it on file system for Android / Desktop. Thank you!!! This made my day

@HEAVYPOLY
Copy link
Contributor Author

I'm able to see generated files in user:// with the iOS files app, but not from godot's file browser with access set to User data, and path set to user:// Is there something else I'm missing?

Also, ideally I would like to put files somewhere external/permanent so user paintings don't get deleted when the app is uninstalled. Is there another info.plist option for external storage?

@Valeryn4
Copy link
Contributor

Valeryn4 commented Feb 21, 2020

I'm able to see generated files in user:// with the iOS files app, but not from godot's file browser with access set to User data, and path set to user:// Is there something else I'm missing?

Also, ideally I would like to put files somewhere external/permanent so user paintings don't get deleted when the app is uninstalled. Is there another info.plist option for external storage?

use share module
IOS does not allow you to directly work with the file system.
This is against the rules of the apple
You can save your pictures to the photo library through a special API or this module
There is a special API PhotoKit
create custom module, example.

@KoBeWi
Copy link
Member

KoBeWi commented Dec 21, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants