ios - 共享扩展帖子照片 : Failed to determine whether URL is managed by a file provider

标签 ios iphone swift

我正在尝试实现一个共享扩展,将图像从 PhotoLibrary 发布到我的应用程序。但我一直遇到这个错误:

2019-01-13 10:57:14.272148-0800 deegeu-swift-share-extensions-image-share[11664:1341769] 
    [default] [ERROR] Failed to determine whether URL /var/mobile/Media/PhotoData/OutgoingTemp/F49538B5-7AD5-46EA-BC0E-CEC304DEEB64/IMG_4293.JPG (s) 
    is managed by a file provider.

这是我正在尝试使用的确切项目源代码:Github Project 这是我密切关注的步骤:Video Tutorial

我的系统信息:iOS 12.1iPhone 6s

我已在 Xcode 中将应用程序组、开发人员简介等项目信息更新为我自己的。

可能是什么原因?

最佳答案

我认为打印错误来自照片应用程序。对我有用的解决方案是:

  itemProvider.loadItem(forTypeIdentifier: kUTTypePNG as String) { [unowned self] (imageData, error) in
                        if let item = imageData as? NSURL {
                            let data = NSData(contentsOf : item as URL)
                            let image = UIImage(data : data! as Data)
                            print(image)
                        } else {
                            if let item = imageData as? UIImage{
                                print(item)
                            }
                        }
                    }

错误仍然存​​在,但我创建了我需要的 UIImage 实例。第一个条件是从照片应用程序共享,否则我将获得正确的图像。

关于ios - 共享扩展帖子照片 : Failed to determine whether URL is managed by a file provider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54172225/

相关文章:

ios - 在 UIPageViewController 中嵌入 UIScrollView 并禁用 pageView 滑动?

ios - 为所有设备设置常量

iphone - iOS : C to iOS of static const char array gives error

iphone - 检查是否在UIPinchGestureRecognizer中释放了捏

c++ - 使用 LineIterator 访问沿线的像素强度值

ios - 连接到Firebase时如何在重启后保存tableView分离

iphone - iOS 上传 .pdf 文件

iphone - iOS 6 中的 MapKit - 如何查找附近的地点...?

objective-c - 在网站上进行身份验证并使用 objective-c 进行屏幕抓取

ios - 如何将 CXCallController 置于最前面