UIDocumentInteractionController工作但不显示“保存图像”

问题描述 投票:2回答:1

我创建并呈现带有有效URL的UIDocumentInteractionController到保存的图像但是当我呈现控制器时“保存图像”不会出现。

NSURL *url = ...;
self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:url];
[self.interactionController presentOptionsMenuFromBarButtonItem:sender animated:YES];

我已经验证self.interactionController.UTI是有效的图像类型(jpeg)

______实际____与.____预期_____

Actual image____ Expected image

注意*如果有人知道格式化这些图像的更好方法,请成为我的客人

ios uidocumentinteraction
1个回答
2
投票

为了能够选择保存到相机胶卷,应用程序必须具有访问照片的权限。

相对于ALAuthorizationStatus[ALAssetsLibrary authorizationStatus]

显示“保存图像”

  1. ALAuthorizationStatusAuthorized
  2. ALAuthorizationStatusNotDetermined

“保存图像”未显示

  1. ALAuthorizationStatusRestricted
  2. ALAuthorizationStatusDenied

你可以像这样检查一下:

#import <AssetsLibrary/AssetsLibrary.h>

- (BOOL)canSaveToCameraRoll
{
    ALAuthorizationStatus status = [ALAssetsLibrary authorizationStatus];
    return (status == ALAuthorizationStatusAuthorized || status == ALAuthorizationStatusNotDetermined);
}
© www.soinside.com 2019 - 2024. All rights reserved.