选择照片后,裁剪视图中仅显示黑色空图像。 (在 2.4.0、swift 5 上测试)
感谢您的反馈! 我现在没有时间进行调查,因此对诊断问题的任何帮助将不胜感激!
TimOliver 我有一个解决方案,但只是测试最后一次
这似乎是一个权限问题。
createDataWithMappedFile:1508: 'open' failed '/var/mobile/Media/PhotoData/CPLAssets/group498/E850D458-F829-4B19-8FBF-95D6F6CC34BA.HEIC' error = 1 (Operation not permitted)
你看到相同的日志吗?
我的应用程序确实有完整的专辑权限。 情况似乎并非如此。
它在 13.1 beta2 中照常工作。 此问题可能仅是 13.1 beta 1 的错误。
我想分享更多的测试信息:
(1) 我的应用程序没有请求访问照片库的明确许可。 (https://stackoverflow.com/questions/46404628/ios11-photo-library-access-is-possible-even-if-settings-are-set-to-never)
(2) iOS 12.4.1(最新)没有问题 - 一切顺利!
(3)iOS 13.0 beta 没有测试,但我猜13.0版本没有问题。
(4) 我在 13.1 beta 1 中遇到了问题
(5) 问题在13.1 beta 2版本修复
您能否与我分享官方文档或有关 iOS 13 中权限更改的任何信息?
忽略这个。 我的问题已通过https://github.com/TimOliver/TOCropViewController/issues/365解决
面临同样的问题。 选择图像后,只出现黑屏。
代替cropViewController.dismiss(animated: true, completion: nil).
和let viewController = cropViewController.children.first!
viewController.modalTransitionStyle = .coverVertical
viewController.presentingViewController?.dismiss(animated: true, completion: nil)
@Stijnk008谢谢。 它工作正常。
更改需要在 repo 中更新。
@Stijnk008你先生是一个绝对的传奇! 你刚刚在现场演示日之前救了我几个小时。 呸!
在最新的官方 13.1.2 版本中仍然遇到此问题。 Stijnk008 的解决方案在这种情况下仍然有效。
图书馆需要更新吗?
谁能解释为什么新 ios 版本的行为如此奇怪?
这对我有用:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
guard let image = (info[UIImagePickerController.InfoKey.originalImage] as? UIImage) else { return }
let cropController = CropViewController(croppingStyle: croppingStyle, image: image)
cropController.delegate = self
cropController.customAspectRatio = CGSize(width: 1.0,height: 1.2)
cropController.aspectRatioLockEnabled = true
cropController.resetAspectRatioEnabled = false
cropController.modalPresentationStyle = .fullScreen
picker.dismiss(animated: true, completion: {
let viewController = cropController.children.first!
viewController.modalTransitionStyle = .coverVertical
viewController.presentingViewController?.dismiss(animated: true, completion: nil)
// the code below allows you to present the cropController ( for me )
self.row?.delegate?.present(cropController, animated: true, completion: nil)
})
}
嘿伙计! 嗯,所以我只是在 master 分支的库中添加了modalPresentationStyle = .fullScreen
。 这应该有望解决图书馆表现出的大多数奇怪行为。
如果您仍然遇到此问题,请您从 master 那里拉一下,看看是否已解决?
与此同时,我注意到非 FaceID 设备上有很多视觉故障,所以我现在必须优先考虑。
谢谢!
@Stijnk008只是我替换并且工作正常😀谢谢
凉爽的。 我认为这已经解决了。 如果其他人遇到同样的问题,请打开一个新问题!
最有用的评论
代替
cropViewController.dismiss(animated: true, completion: nil).
和
let viewController = cropViewController.children.first! viewController.modalTransitionStyle = .coverVertical viewController.presentingViewController?.dismiss(animated: true, completion: nil)