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访问照片库所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)