Is there a way to use the iPhone proximity sensor to detect whether the phone is in a room with no light?
This question seems to imply that this is not possible...Do
If you're doing some Augmented Reality stuff using ARKit you can get the lightEstimate value on each frame of the video feed from the ARSession.
lightEstimate
ARSession
See documentation on this.