-
Notifications
You must be signed in to change notification settings - Fork 1
Save Image to Camera Roll
Saving any texture to the camera roll is fairly simple and can be accomplished with ISN_PhotoAlbum
class. The example below adds the specified image to the user’s Camera Rol. When used on an iOS device without a camera, this method adds the image to the Saved Photos album rather than to the Camera Roll album.
using SA.iOS.UIKit;
...
Texture2D myImage = GetImage();
ISN_PhotoAlbum.UIImageWriteToSavedPhotosAlbum(myImage, (result) => {
if(result.IsSucceeded)
Debug.Log("Image saved");
else
Debug.Log("Error: " + result.Error.Message);
});
Based on iOS UIKit::UIImageWriteToSavedPhotosAlbum
There is also an ability to save a screenshot out of the box:
using SA.iOS.UIKit;
...
ISN_PhotoAlbum.SaveScreenshotToCameraRoll((result) => {
if (result.IsSucceeded)
Debug.Log("screenshot saved saved");
else
Debug.Log("Error: " + result.Error.Message);
});
Important: Do not forget that you can use Photo Library related API, only after a user has authorized access to Photo Library for your app. If you try to use API without authorization, the system will ask for permission automatically. If a user allows Photo Library access, you good, otherwise, an operation will be failed, and you may not even receive a callback from the method. So it's in your best interest to request user authorization before you attempt to use a Photo Library.
Reliable and high-quality Unity Development service. Let's Talk!
Website | AssetStore | LinkedIn | Youtube | Scripting Reference
- Getting Started
- Authentication
- Game Center UI
- Leaderboards
- Default Leaderboard
- Achievements
- Saving A Game
- Access Point
- iTunes Connect Setup
- StoreKit Initialization
- Purchase flow
- Receipt Validation
- Store Review Controller
- Storefront API
- Subscription Offers