Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Named colors do not work prior to iOS 11.0" error referring to a storyboard

Tags:

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:

Error, text transcription: see below

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?

like image 867
Tamás Sengel Avatar asked Dec 28 '17 20:12

Tamás Sengel


2 Answers

  1. Open the storyboard as Source Code. (right click on the storyboard file inside the Project navigator/Open As/Source Code)

    Open As/Source Code

  2. Navigate to Find/Find and Replace... (or press ⌥⌘F).

  3. Open the dropdown list on the right side and select Regular Expression.

    the button that toggles the dropdown on the right side of the Find view

    Regular Expression selected from the dropdown

  4. 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.

  5. 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.

like image 100
Tamás Sengel Avatar answered Sep 28 '22 11:09

Tamás Sengel


For cordova projects, I fixed updating the config.xml from

<preference name="deployment-target"            value="10" /> 

to

<preference name="deployment-target"            value="12" /> 
like image 41
chispitaos Avatar answered Sep 28 '22 10:09

chispitaos