ios – 为什么我不能使用UIImagePickerController访问照片库

ios – 为什么我不能使用UIImagePickerController访问照片库,第1张

概述没有错误,但是当我在真实手机上进行测试时,即使在模拟中,它也只显示一个锁定图像,并且“此应用程序无法访问您可以在隐私设置中启用访问的照片或视频”,但当我转向设置我在隐私设置中找不到我的应用程序.我哪里做错了? override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)

没有错误,但是当我在真实手机上进行测试时,即使在模拟中,它也只显示一个锁定图像,并且“此应用程序无法访问您可以在隐私设置中启用访问的照片或视频”,但当我转向设置我在隐私设置中找不到我的应用程序.我哪里做错了?

overrIDe func tableVIEw(tableVIEw: UItableVIEw,dIDSelectRowAtIndexPath indexPath: NSIndexPath) {    if indexPath.row == 0 {        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Photolibrary){            let imagePicker = UIImagePickerController()            imagePicker.delegate = self            imagePicker.allowsEditing = false            let selectedSourceAction = UIAlertController(Title: "What source do you want to access?",message: "",preferredStyle: UIAlertControllerStyle.ActionSheet)            let fromPhotolibrary = UIAlertAction(Title: "Photo library",style: UIAlertActionStyle.Default,handler: {(action: UIAlertAction!) -> VoID in                imagePicker.sourceType = UIImagePickerControllerSourceType.Photolibrary                self.presentVIEwController(imagePicker,animated: true,completion: nil)        })            let fromCamera = UIAlertAction(Title: "Camera",handler: {(action: UIAlertAction!) -> VoID in                imagePicker.sourceType = UIImagePickerControllerSourceType.Camera                self.presentVIEwController(imagePicker,completion: nil)            })            let cancelAction = UIAlertAction(Title: "Cancel",style: .Cancel,handler: nil)            selectedSourceAction.addAction(fromPhotolibrary)            selectedSourceAction.addAction(fromCamera)            selectedSourceAction.addAction(cancelAction)            self.presentVIEwController(selectedSourceAction,completion: nil)        }    }func imagePickerController(picker: UIImagePickerController,dIDFinishPickingMediawithInfo info: [String : AnyObject]) {    imageVIEw.image = info[UIImagePickerControllerOriginalimage] as? UIImage    imageVIEw.contentMode = UIVIEwContentMode.ScaleAspectFit    imageVIEw.clipsToBounds = true    dismissVIEwControllerAnimated(true,completion: nil)}
解决方法 当您的应用程序的Info.pList文件包含一个键:“CFBundledisplayname”,其中包含空字符串值时,IOS 9上可能会发生此类错误. 总结

以上是内存溢出为你收集整理的ios – 为什么我不能使用UIImagePickerController访问照片库全部内容,希望文章能够帮你解决ios – 为什么我不能使用UIImagePickerController访问照片库所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1070194.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存