1
我想通过Swift 2 iOS9中的照片框架获取照片。不允许访问图像,而不是访问图像的权限。如何获得iOS 9照片访问权限与照片框架
我想通过Swift 2 iOS9中的照片框架获取照片。不允许访问图像,而不是访问图像的权限。如何获得iOS 9照片访问权限与照片框架
只需在构建阶段的“Link Binary With Libraries”中添加Photos框架,然后在需要的框架中导入框架。
要访问照片的权限,你需要给“捆绑显示名称”在plist文件
和使用下面的代码
PHPhotoLibrary.requestAuthorization { (status) -> Void in
switch status{
case .Authorized:
dispatch_async(dispatch_get_main_queue(), {
print("Authorized")
})
break
case .Denied:
dispatch_async(dispatch_get_main_queue(), {
print("Denied")
})
break
default:
dispatch_async(dispatch_get_main_queue(), {
print("Default")
})
break
}
}