-
Notifications
You must be signed in to change notification settings - Fork 1
Save to Camera Roll
Save any texture to 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 Roll album. 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(image, (result) =>
{
if (result.IsSucceeded)
Debug.Log("Image saved");
else
Debug.Log("Error: " + result.Error.Message);
});
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'll try to use API without authorization, the system will ask for authorization automatically. If a user will allow 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. Read more about Photo Library authorization here.
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