Xcode 相机:无法读取 ExposureBiasesByMode 字典

r.g*_*ser 26 ios swift

我最近在 Xcode 版本 12.0.1 中的 UIImagePickerController 中遇到了这个错误

[相机] 无法读取exposureBiasesByMode 字典:Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error throwLegacyExceptions:]: 数据为 NULL}

有没有其他人看到过这个错误?你如何解决它?

Öme*_*aca 6

如果您自定义图像选择器,因为imagePicker.allowsEditing = true 您必须使用以下方法获取图像:

if let pickedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage {
    capturedImage = pickedImage    
}
Run Code Online (Sandbox Code Playgroud)

如果您改为使用imagePicker.allowsEditing = false,请使用它来选择图像:

if let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
    capturedImage = pickedImage        
}
Run Code Online (Sandbox Code Playgroud)

如果您不遵循此组合,您可能会收到此错误。


Ama*_*lho 0

当我尝试从无法复制的 URL 进行复制时,出现此错误。这是来自mediaURLUIImagePickerControllerDelegate

\n

基本上,我所做的是使用UISaveVideoAtPathToSavedPhotosAlbum

\n

就像这个例子 \xe2\xa4\xb5\xef\xb8\x8f

\n
if UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(url.absoluteString) {\n            UISaveVideoAtPathToSavedPhotosAlbum(url.absoluteString, self, #selector(self.didSaveVideo), nil)\n        } else {\n            return /* do something*/\n        }\n\n@objc private func didSaveVideo(videoPath: String, error: NSError, contextInfo: Any) {}\n
Run Code Online (Sandbox Code Playgroud)\n