In my application, I need to distinguish between the different displays that I use with the NSScreenNumber key of the device description dictionary provided by NSScreen. So far, everything worked flawlessly, but now all of a sudden I sometimes get a different screen identifier for my main screen (this is a laptop, and I have not attached a second screen for several months, it is always the same equipment). The identifier was 69676672, but now most of the time I get 2077806975.
At first it seemed to me that somehow I misinterpreted NSNumber, but this did not seem to be the case, I also checked it with the CGMainDisplayID () function and got the same value. What's even weirder is that some Apple apps still get the old identifier: for example. the desktop image is referenced in its configuration file using the screen identifier, and when updating the desktop image, the Apple desktop application uses the “correct” (= old) ID.
I'm starting to wonder if there could be a change in a recent update (10.7.1 or 10.7.2) that led to the change, has anyone else noticed something like this, or had this problem before?
Here is the code I'm using:
// This is in an NSScreen category - (NSNumber *) uniqueScreenID { return [[self deviceDescription] objectForKey:@"NSScreenNumber"]; }
And to get int:
// Assuming screen points to an instance of NSScreen NSLog(@"Screen ID: %i", [[screen uniqueScreenID] intValue]);
This is starting to upset, appreciate any help / ideas, thanks!
Robin source share