detecting if iPhone is in a dark room

后端 未结 6 1622
独厮守ぢ
独厮守ぢ 2020-11-30 03:40

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

6条回答
  •  误落风尘
    2020-11-30 04:02

    Although it is possible to access the ambient light sensor data through IOKit framework, Apple discourages developers from using it, and any apps using it will be rejected from App Store.

    But it is possible to deduce the luminosity of the environment approximately through the camera. That is by implementing the camera through AVFoundation framework and processing the meta data coming though each of the camera frames. Refer to this answer on question : How to get light value from AVFoundation

提交回复
热议问题