i am developing an app using objc. I have to select the new macro camera, which is present in iPhone 13 Pro and 13 Pro Max. Currently i select my camera on all other devices with this code snipped:
AVCaptureDeviceDiscoverySession *discoverySession = [AVCaptureDeviceDiscoverySession
discoverySessionWithDeviceTypes:@[ AVCaptureDeviceTypeBuiltInWideAngleCamera ]
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionBack];
_captureDevice = discoverySession.devices[0];
But the documentation of the AVCaptureDeviceType does not provide any device type for the macro camera one: https://developer.apple.com/documentation/avfoundation/avcapturedevicetype?language=objc
Did apple forgot to add a type for the macro camera here, or is there something missing in the documentation?
Nevertheless i was able to select it with in my eyes very ugly and non stable method:
_captureDevice = [AVCaptureDevice deviceWithUniqueID:@"com.apple.avfoundation.avcapturedevice.built-in_video:5"];
I determined the string ending 5 only by testing against an existing device. I am also missing here some kind of documentation or ensurance that this will still provide me the macro camera, even after an ios update ;)
Does somebody know an reliable way to get the macro camera for in ios app development?