Note that there are some explanatory texts on larger screens.

plurals
  1. PONSScreenNumber changes (randomly)?
    text
    copied!<p>In my application I need to distinguish between different displays, which I do by using the NSScreenNumber key of the deviceDescription dictionary provided by NSScreen. So far everything worked flawlessly, but now all of a sudden I sometimes get a different screen ID for my main screen (it's a laptop and I haven't attached a second screen in months, its always the same hardware). The id used to be 69676672 but now most of the time I get 2077806975.</p> <p>At first I thought I might be misinterpreting the NSNumber somehow, but that doesn't seem to be the case, I also checked by using the CGMainDisplayID() function and I get the same value. What is even weirder is that some of the Apple applications still seem to get the old ID: Eg. the desktop image is referenced in its config file using the screen ID and when updating the desktop image the desktop image app by Apple uses the "correct" (=old) ID.</p> <p>I am starting to wonder if there might have been a change in a recent update (10.7.1 or 10.7.2) that led to the change, has anybody else noticed something similar or had this issue before?</p> <p>Here is the code that I use:</p> <pre><code> // This is in an NSScreen category - (NSNumber *) uniqueScreenID { return [[self deviceDescription] objectForKey:@"NSScreenNumber"]; } </code></pre> <p>And for getting an int:</p> <pre><code> // Assuming screen points to an instance of NSScreen NSLog(@"Screen ID: %i", [[screen uniqueScreenID] intValue]); </code></pre> <p>This is starting to get frustrating, appreciate any help/ideas, thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload