Solve the problem of Xcode running Use of undeclared identifier'AVCaptureDeviceTypeBuiltInUltraWideCamera'

I encountered this error when I ran XCode today. I searched and found that no one has raised this question on the Internet? Let me record my solution.

1. Operating environment:

1. Xcode simulator ios version 13.5.1

2. Install the package react-native-camera, the stable version installed directly by default: npm install git+https://[email protected]/react-native-community/react-native-camera.git

3. react-native version: 0.63.2

2. Running error:

Use of undeclared identifier'AVCaptureDeviceTypeBuiltInUltraWideCamera'

Locating to Xcode is an error in the red box part. The solution is to comment it out directly.

3. Explanation

First AVCaptureDevice A device that provides input (such as audio or video) to a capture session and provides controls for hardware-specific capture features. It is an interface about the hardware, which is used to configure the properties of the underlying hardware (such as focus, flash, exposure, etc.). These underlying hardware include front camera, rear camera, microphone, flash, etc. So these few lines of code mean to apply for permission to call hardware on systems above IOS13.0.

You can see that AVCaptureDeviceTypeBuiltInUltraWideCamera actually applied for a camera permission corresponding to the focal length, so directly commenting out this line of code here has little effect. (Our app is not a professional photography app, and the requirements for camera permissions are not so high. You only need to call it up)

 

Reference article:  https://www.jianshu.com/p/b1b3d584c59b

Guess you like

Origin blog.csdn.net/qq_31915745/article/details/108261781