UIDocumentInteractionController可以工作,但不会显示"保存图像"

时间:2015-06-03 21:45:55

标签: ios uidocumentinteraction

我创建并向保存的图像显示带有有效网址的NSURL *url = ...; self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:url]; [self.interactionController presentOptionsMenuFromBarButtonItem:sender animated:YES]; 但是当我出示控制器时#34;保存图像"没有出现。

self.interactionController.UTI

我已验证ALAuthorizationStatus是有效的图片类型(jpeg)

______ Actual_______ vs .____预期_____

Actual image ____ Expected image

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

1 个答案:

答案 0 :(得分:2)

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

相对于ALAuthorizationStatusAuthorized[ALAssetsLibrary authorizationStatus]

"保存图片"显示为

  1. ALAuthorizationStatusNotDetermined
  2. ALAuthorizationStatusRestricted
  3. "保存图片"

    不显示
    1. ALAuthorizationStatusDenied
    2. #import <AssetsLibrary/AssetsLibrary.h> - (BOOL)canSaveToCameraRoll { ALAuthorizationStatus status = [ALAssetsLibrary authorizationStatus]; return (status == ALAuthorizationStatusAuthorized || status == ALAuthorizationStatusNotDetermined); }
    3. 您可以这样检查:

      # urls.py
      
      patterns = urlpatterns('',
          #...
          url(r'whatever/(P?<subject>[a-z-]+>)/$', 'myviews.index', ...),
          )
      
      # myviews.py
      def index(request, subject):
          # do whatever
          context = {
             # whatever else
             'subject':subject
             }
         return render(request, "whatever/index.html", context)
      
      # whatever/index.html
      <html>
         # headers etc
         <body class="something {{ subject }} etc">
           # whatever here
         </body>
      </html>