Invalid color System, labelColor (warning given only once)
Asked Answered
I

2

10

I am getting following warning on OS X 10.9 console at the time of nib load(NSWindowController).

Invalid color System, labelColor (warning given only once)

I am using Xcode 6 and OS X 10.10 to compile my code. Most probably this warning is coming because of NSColor exposes new system colors in 10.10 for static text and related elements: labelColor, secondaryLabelColor, tertiaryLabelColor, and quaternaryLabelColor.

How to fix this warning?

Irbm answered 16/12, 2014 at 15:11 Comment(2)
Are this warning showing in the log when you execute the app under 10.9 or is it when you open the project in Xcode in a 10.9 environment?Coniology
When i am executing on 10.9Irbm
D
12

Change your textfield's color in your xib file from:

<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>

to:

<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>

Since "labelColor" is not a formal color name in OSX 10.9.

Decani answered 31/12, 2014 at 13:51 Comment(1)
This is a great workaround but I encourage you all to file a radar for this. Xcode seems to ignore the minimum target and therefore breaks the XIB. We shouldn't need a preflight script to edit out an obvious format error.Carcanet
C
0

The warning is there to inform you the color is not available in 10.9 (or below). You could simply check the OS version (using AppKit constant NSAppKitVersionNumber) and handle the color properly according to the version.

Good reading: Apple Developer Guide on SDK Compatibility

Coniology answered 28/12, 2014 at 10:56 Comment(1)
This warning is coming when i am loading xib and i can not access any property/object of xib before loading.Irbm

© 2022 - 2024 — McMap. All rights reserved.