Reputation: 17536
I create and present a UIDocumentInteractionController
with a valid url to a saved image but when I present the controller "Save Image" does not appear.
NSURL *url = ...;
self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:url];
[self.interactionController presentOptionsMenuFromBarButtonItem:sender animated:YES];
I have verified self.interactionController.UTI
is a valid image type (jpeg)
Note* If anyone knows a better way to format those images please be my guest
Upvotes: 2
Views: 1247
Reputation: 17536
In order to have the option to save to the camera roll, the app must have permission to access photos.
Relative to ALAuthorizationStatus
([ALAssetsLibrary authorizationStatus]
)
"Save Image" is displayed for
ALAuthorizationStatusAuthorized
ALAuthorizationStatusNotDetermined
"Save Image" is not displayed for
ALAuthorizationStatusRestricted
ALAuthorizationStatusDenied
You can do a check like this:
#import <AssetsLibrary/AssetsLibrary.h>
- (BOOL)canSaveToCameraRoll
{
ALAuthorizationStatus status = [ALAssetsLibrary authorizationStatus];
return (status == ALAuthorizationStatusAuthorized || status == ALAuthorizationStatusNotDetermined);
}
Upvotes: 2