Application freezes when trying to present rear camera on iPad

前端 未结 4 1695
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-02 19:46

The application that i am working on runs on both iPhone & iPad . One of the functionality that the application has, is to capture image from camera. I am using UIImageP

4条回答
  •  春和景丽
    2021-01-02 20:18

    Here's how you can set an environmental variable: https://stackoverflow.com/a/31874419/3724800

    And here's the code I use to open the camera in a Universal app:

    if UIImagePickerController.isSourceTypeAvailable(.camera) {
                let imagePicker = UIImagePickerController()
                imagePicker.delegate = self
                imagePicker.sourceType = .camera;
                imagePicker.allowsEditing = false
                present(imagePicker, animated: true, completion: nil)
    }
    

提交回复
热议问题