UIColor(named:) always returns nil on iOS 11.0-11.2

前端 未结 2 972
一生所求
一生所求 2021-02-08 09:15

I have a class that returns a UIColor from my custom palette. I call this programmatically but when I tested it on iOS 11 it always returns a nil result... I tried

相关标签:
2条回答
  • 2021-02-08 09:28

    Edit:

    This was a bug in Xcode and its fixed in the new GM Seed 2 (11A420a).


    I encountered this issue as well. I was using Xcode 11 beta 6, with Command Line Tools 11.0.

    I solved it by switching to Xcode 10.2.1 and Command Line Tools 10.2.1, cleaning & building again.

    0 讨论(0)
  • 2021-02-08 09:44

    I hit this issue as well and my app uses xibs and storyboards extensively.

    I was able to get around the issue by pointing Xcode beta 6 to the asset compiler (actool) from Beta 5 which I still had on my machine. You will need to link to this version (sample command: ln -s /Applications/Xcode-beta5.app/Contents/Developer/usr/bin/actool actool from within your Beta 6/7 path).

    Unsure if this will cause any issue with app submission, but I confirmed that app on iOS 11 looks as it should again (light colors).

    0 讨论(0)
提交回复
热议问题