LightSensor doesn't work

Hello,
I am new to the App Inventor and i wanted to use the Light Sensor. But when i try to use it with the classic .LightChanged Block, i get an error with the message "undefined variable. (irritants: yail/com.google.appinventor.components.runtime.LightSensor)". I use the ios app to connect it with my iphone. Does anybody know the solution of this problem?
Thanks a lot! :slight_smile:

it might be a bug with ios there are cuurently some bugs with ios maybe appinventor staff can take a look here

Hello Jon

Apple phones are using the same type of light sensor as Android phones. It is probably the case that access to them in an Apple phone is different - or it could be that access is simply not available, given that the sensor is fully automated. On Android, an App can only read the sensor value (current brightness, measured in lux).

Well, it does not appear that support for this component has been added to iOS (maybe in the future, the team is currently fixing bugs)

can you share the link to that webpage?

Unfortunately, it looks as though Apple does not provide a public API for developers to read the ambient light sensor on iOS devices, and attempts to interact with private APIs for this data have resulted in apps being removed from the App Store. My guess is that we likely won't implement this component for iOS until Apple provides a public API with guarantees they wouldn't penalize apps for using this feature.

2 Likes