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

I can not write image to the ios gallery with 'cordova-plugin-file' #451

Closed
3 tasks
snowdream opened this issue Jan 10, 2021 · 7 comments
Closed
3 tasks

Comments

@snowdream
Copy link

Bug Report

Problem

I have a image with base64 data.
now i want to write the image to the ios gallery with 'cordova-plugin-file',But i failed.
I do not know which path i can write to .

cordova.file.dataDirectory?
cordova.file.documentsDirectory?

What is expected to happen?

The image can be shown in the gallery of the iphone.

What does actually happen?

The image can not be shown in the gallery of the iphone.

Information

Command or Code

Environment, Platform, Device

Version information

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@timbru31
Copy link
Member

Thanks a lot for your issue, however this channel is for bug and feature requests, not for support. 😊
You can try asking on StackOverflow or in our Slack community.

@jfoclpf
Copy link

jfoclpf commented Mar 8, 2021

You can try asking on StackOverflow or in our Slack community.

@timbru31 actually it has been asked one year ago, with no conclusive replies
https://stackoverflow.com/questions/60559455/how-to-save-file-in-ios-using-cordova-plugin-file
Could you kindly take a look?

I'm having exactly the same issue. Thanks

@breautek
Copy link
Contributor

breautek commented Mar 8, 2021

I'm having exactly the same issue. Thanks

IOS is a closed system. You can't access the iOS gallery via the filesystem.

There are special native apis for writing and reading to the gallery. You'll need to find a plugin, or write your own that interfaces these APIs.

I'm not an expert on native iOS development but I believe
https://developer.apple.com/documentation/photokit would be helpful should you write your own plugin.

@jfoclpf
Copy link

jfoclpf commented Mar 8, 2021

Thank you @breautek indeed it seems another user used cordova-plugin-x-social-sharing to save files in iOS accessible to end user. I'll give a try. Do you happen to know any other plugin applicable therefor?

@breautek
Copy link
Contributor

breautek commented Mar 8, 2021

Thank you @breautek indeed it seems another user used cordova-plugin-x-social-sharing to save files in iOS accessible to end user. I'll give a try. Do you happen to know any other plugin applicable therefor?

No. That's not a problem I ever needed to solve. Sorry.

@jfoclpf
Copy link

jfoclpf commented Mar 8, 2021

Thanks anyway. Have a great day

@jfoclpf
Copy link

jfoclpf commented Mar 22, 2021

Just to let you know that this issue is fixed. I tested now and it does work!

Simply edit your config.xml adding these entries inside <platform name="ios">

<edit-config target="UIFileSharingEnabled" file="*-Info.plist" mode="merge">
  <string>YES</string>
</edit-config>
<edit-config target="LSSupportsOpeningDocumentsInPlace" file="*-Info.plist" mode="merge">
  <string>YES</string>
</edit-config>
<edit-config target="UISupportsDocumentBrowser" file="*-Info.plist" mode="merge">
  <string>YES</string>
</edit-config>

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

No branches or pull requests

4 participants