iOS 13 app has wrong colors when it's run on iOS 11

Greetings,

when I run my iOS 13 app in a iOS 11 simulator some of the colors in my asset catalog were incorrectly dsiplayed. Some colors came up as if the iOS 11 device was in dark mode and some colors were correct. Ideally it should have worked just as it does on iOS 12. I assumed that since named colors were available in iOS 11 that on on that platform the light colors would be used, since that is all that is known?


We have a requirement that our app runs on the last 3 major versions of iOS, so it is imperative that this works


Edit: This is an issue with Xcode beta 6. I recall my app displaying colors correctly when it was run on Xcode beta 5 via the simulator.


Edit2: I should point out that this also happens with image catalogs. Instead of picking the 'Any' image from the image set, it sometimes pick a dark mode one on iOS 11.


Thanks in advance,

Neal

Accepted Reply

ive never seen this before but for you who have issues with this, apple has literally put it on their main page that this is an issue. Very odd, but at least they know. Unfortunatly the solution is to support 12.0 until they fix it..


"Please note that apps built with Xcode 11 using named colors may experience lookup failures (with no value returned) when the app runs on iOS 11 or earlier. This will be fixed in a future Xcode update. To avoid this issue, raise the minimum deployment target to iOS 12 or later to submit to the App Store now, or rebuild with the next Xcode GM candidate seed when it’s available."


under dark mode.


https://developer.apple.com/ios/submit/

Replies

Do ios 11 and 12 not use the "Any" colors? They may not know to use the "light" colors.

Hi J0hn,

I'm 100% certain that my app displayed colors correctly when it was running on Xcode 11 beta 5 via an iOS 11 simulator. This is a new issue with Xcode 11 beta 6. The app should be using the 'Any" color. And it was on Xcode 11 beta 5. This was on the simulator (I don't have a iOS 11 physical device).


Edit: Found a machine which had Xcode 11 beta 5 and sure enough my app displayed all colors correctly as the 'Any" color. This is an issue in the Xcode 11 beta 6.


Neal

We also get this too, thought we were going crazy.


We have the requirement as well to support iOS11 for the next year.


Did you raise a radar at all on it?

Same here. UIColor(named: "...") always returns nil on iOS 11, while everything is fine on iOS 12 and 13. It worked up to Xcode 11 beta 5, but something has broken with beta 6 (and also 7 released yesterday).


I wanted to submit a radar, but I couldn't replicate the issue on a blank new project.

I replicated in a new project and raised the following with the sample project.


FB7144402

This issue still happens with the latest - Xcode 11 beta 7. This has to be addressed soon so that we know what action to take prior to iOS 13 public release

There's a Stack Overflow question about this as well. Looks like its related to XCode 11 beta 6 & 7:

https://stackoverflow.com/questions/57658176/uicolornamed-always-returns-nil-on-ios-11-0-11-2/57684566#57684566

We are having the exact same issue. Xcode 11 beta 6 or 7 running on iOS 11 UIColor(named: "...") always returns nil

For now we have worked around it on iOS 11 but it has meant a ton of extra code.


Hopefully it will be fixed but hopefully you've raised a Radar yourself?

Does anyone on this thread have any iOS 11.x devices that they've tried this on? Trying to determine if this is a simulator issue or a real issue.


Thanks,


Neal

I have run into a similar problem, where UIColor(named:) would return nil on (at least the simulator) iOS <13.


Luckily, I was already using a tool I had created which generates an Asset Catalog from colors specified in a plain text file. This way I could generate Swift code which does not rely on Asset Catalogs, but instead uses the new UIColor(dynamicProvider:) initializer on iOS 13 with a fallback for older versions.


This might be overkill depending on your situation, but in case it might be useful for anyone you can find it here: https://github.com/nesium/xcode-color-assets

Just reproduce it on 8+ ios 11.2

Xcode 11 GM still has this issue.

Yes, I was hoping this issue would disappear with the GM. But no luck.

Any updates on the filed radar (FB7144402), lesmond?

I could not replicate this problem in a new project, if you share you project we can also submit radars.

ive never seen this before but for you who have issues with this, apple has literally put it on their main page that this is an issue. Very odd, but at least they know. Unfortunatly the solution is to support 12.0 until they fix it..


"Please note that apps built with Xcode 11 using named colors may experience lookup failures (with no value returned) when the app runs on iOS 11 or earlier. This will be fixed in a future Xcode update. To avoid this issue, raise the minimum deployment target to iOS 12 or later to submit to the App Store now, or rebuild with the next Xcode GM candidate seed when it’s available."


under dark mode.


https://developer.apple.com/ios/submit/