Swift3.0 & Xcode8解决present(uiImagePickerController,animated: true,completion: nil)闪退的问题

在xcode8-beta版本中访问照片库的时候如下面的代码,会出现闪退的情况

       //判断能否打开相册
        if !UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
            print("不能打开相册")
            return
        }
        // 2.创建图片选择器
        let vc = UIImagePickerController()
        vc.delegate = self
        present(vc, animated: true, completion: nil)

解决方法:需要在info.plist里面配置一下

Swift3.0 & Xcode8解决present(uiImagePickerController,animated: true,completion: nil)闪退的问题_第1张图片
Snip20160815_1.png

再次运行,闪退问题得到解决.

你可能感兴趣的:(Swift3.0 & Xcode8解决present(uiImagePickerController,animated: true,completion: nil)闪退的问题)