相关疑难解决方法(0)

UIImagePickerController崩溃app | Swift3,Xcode8

仅供参考:我是Swift的新手,所以这可能是一个非常简单的问题,但我无法理解.

我一直在使用Xcode 8 beta和Swift 3 开始开发iOS应用程序(Swift)教程.

我将Tap Gesture Recognizer附加到Image View,然后在ViewController.swift中添加了这个动作:

@IBAction func selectImageFromPhotoLibrary(_ sender: UITapGestureRecognizer) {
        // Hide the keyboard.
        nameTextField.resignFirstResponder()

        // UIImagePickerController is a view controller that lets a user pick media from their photo library.
        let imagePickerController = UIImagePickerController()

        // Only allow photos to be picked, not taken.
        imagePickerController.sourceType = .photoLibrary

        // Make sure ViewController is notified when the user picks an image.
        imagePickerController.delegate = self

        present(imagePickerController, animated: true, completion: nil)
    }
Run Code Online (Sandbox Code Playgroud)

当通过点击图像视图调用selectImageFromPhotLibrary Action时,应用程序崩溃而不显示ImagePicker.

我想问题是新的礼物而不是在Swift …

xcode ios swift swift3 xcode8

26
推荐指数
3
解决办法
1万
查看次数

标签 统计

ios ×1

swift ×1

swift3 ×1

xcode ×1

xcode8 ×1