美文网首页
Swift3.0 & Xcode8解决present(u

Swift3.0 & Xcode8解决present(u

作者: 07212a79db66 | 来源:发表于2016-08-15 10:04 被阅读161次

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

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

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

Snip20160815_1.png

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

相关文章

网友评论

      本文标题:Swift3.0 & Xcode8解决present(u

      本文链接:https://www.haomeiwen.com/subject/aclusttx.html