0

Normally registering for UIScreenBrightnessDidChangeNotification provides notifications when the user finishes sliding the brightness slider in control center. It appears there is a bug that prevents notifications from being sent when the brightness is set to 0.0. Basically the range of values which produce notifications are (0.0, 1.0]

Am I missing something here?

Testing is as simple as:

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserverForName:UIScreenBrightnessDidChangeNotification
                    object:nil
                     queue:nil
                usingBlock:^(NSNotification *notification)
{
    NSLog(@"Brightness changed: %f", [[UIScreen mainScreen] brightness]);
}];
Warpling
  • 2,024
  • 2
  • 22
  • 38
  • I tested it on a device and apparently you're right. It only works when I set brightness to 1.0, then go all the way to 0.0. So from 1.0 -> 0.0 it logs 0.0. But from anything else -> 0.0 it doesn't log anything. – Armin Feb 02 '15 at 19:18
  • I think you should report it on https://bugreport.apple.com/ – Armin Feb 02 '15 at 19:19
  • Thank you for confirming @Armin! I found [a duplicate via OpenRadar](http://blackpixel.com/blog/2012/02/radar-or-gtfo.html) and filed my own actual Radar (#19686330). Please feel free to help file a duplicate! Thanks again for proving I'm not crazy :) – Warpling Feb 02 '15 at 21:36
  • hahaha no worries! I tested on an iPhone 4S btw. Will do. – Armin Feb 02 '15 at 21:37

0 Answers0