While developing an iOS application for targets below iOS 11, I accidentally left a named color in one of my storyboards. However, the error I got only shows the name of the storyboard and not the exact view that is causing the issue:
Named colors do not work prior to iOS 11.0
Main.storyboard
How can I find the exact views that have a named color as a property and replace those with a non-named color?
Open the storyboard as Source Code. (right click on the storyboard file inside the Project navigator/Open As/Source Code)
Navigate to Find/Find and Replace... (or press ⌥⌘F).
Open the dropdown list on the right side and select Regular Expression.
For the search term, enter the following regex:
color key=(.*) name=.*
For the replacement, enter this:
color key=$1 red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
This regular expression essentially captures the key of the color
property with (.*)
and inserts it again with $1
.
Keep in mind that this example replaces the color to white. Change the color by providing a different RGB value.
Switch back to Interface Builder by navigating to Open As/Interface Builder - Storyboard in the right click menu that was mentioned in the first step.
For cordova projects, I fixed updating the config.xml from
<preference name="deployment-target" value="10" />
to
<preference name="deployment-target" value="12" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With