Skip to content

dinhonms/Save-Media-To-Gallery

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

Unity iOS Save Media Plugin

iOS Swift Unity plugin to save media into the photo library, at a specific Album.

Motivation

I was looking for an up to date plugin based in Swift/Swift UI, but I did not found it, so that I decided to create one. I hope this can help other people.

Reference

This plugin is a result of some questions from this stackoverflow thread, especially this answer

Specs

  • Xcode 14.0
  • Swift 5.7

πŸ’» Supported platform

This plugin is available only for Unity iOS and Swift UI. If you can help developing an Android version, it will be appreciated.

πŸš€ Ho to install

Extract and place the content of the latest release into Unity Plugins/iOS folder.

Plugins folder:

Assets/Plugins/iOS

β˜• How to use

Call the following code in any script you want.

To save an image:

SaveImage(string imageNameWithExtension, string albumName, OnSuccess onSuccess, OnError onError)

To save a video:

SaveVideo(string videoNameWithExtension, string albumName, OnSuccess onSuccess, OnError onError)

If you have any doubt, refer to this sample project

Troubleshooting

Disable bitcode and make a new build in order to sove this problem:

error build: '.../Save Media Plugin/Frameworks/Plugins/iOS/SaveMediaToGallery.framework/SaveMediaToGallery' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '.../Save Media Plugin/Frameworks/Plugins/iOS/SaveMediaToGallery.framework/SaveMediaToGallery' for architecture arm64

Troubleshooting

πŸ“« Contrubuting with an Android version

If you are interested in contributing to this project, follow the steps:

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Commit your changes: git commit -m '<commit_message>'
  4. Push them: git push origin <project_name> / <local>
  5. Criate a pull request.

Check out the GitHub Pull Request at how to create a pull request.

πŸ“ License

This project is licensed under: you can do whatever you want.

About

iOS Swift Unity plugin to save media into the photo library

Resources

License

Stars

Watchers

Forks

Packages

No packages published