OS:IOS 10和watchos3
大家好,在开发我的最新应用时发现了一个问题。 我的应用程序需要请求photolibrary权限才能保存一些图像。 在手表应用程序和ios中,我已经在plist中添加了照片库访问权限。
我注意到当我在手机应用程序在前台运行时按下我的ios设备上的请求权限时。 隐私权 - 照片库使用说明
一旦ios权限请求成功,监视应用程序将崩溃,使用以下代码程序以退出代码结束:0 ,这似乎是os级行为我
func requestPhotoLibraryPermission(){
PHPhotoLibrary.requestAuthorization { status in
switch status {
case .authorized:
break
default:
self.showErrorMessage(title: NSLocalizedString("Permission Denied", comment: "Permission Denied"), message: NSLocalizedString("You can enable Photo Library permission from the settings app", comment: "You can enable Photo Library permission from the settings app") ,completionBlock: {
})
// place for .NotDetermined - in this callback status is already determined so should never get here
break
}
}
}
如您所见,代码非常简单。有人遇到类似问题吗?有没有已知的解决方法?
答案 0 :(得分:2)
测试了一个全新的项目,同样的问题,我相信iOS通知watchos在权限更改时重新启动应用程序。
在iOS设置页面更改应用权限并返回应用时,行为相同。
答案 1 :(得分:-1)
如果我误解了,请原谅我,但是您是否添加了密钥:“隐私 - 照片库使用说明”以及您的plist键值的使用说明?