Xcode doesn't like Unicode in module names

Note that the problem described below was solved. I'm writing this as a reference in case it happens to someone else.


In an Xcode project, if you create a new target (or rename an existing one) and it contains accented characters (such as in "Étoilé"), you might have some problems when loading nib or storyboard files. Errors like this will pop up in the console:

Unknown class _TtC8Étoilé11AppDelegate in Interface Builder file

None of the classes from your project will get instantiated. This is because the Unicode normalization for your module name is different from the one used in the Interface Builder file. One expresses "É" using two code points: "E" followed by a combined grave accent. The other is using a singled precombined character "É". This can't be observed directly by looking at the string as it is displayed exactly the same, but Interface Builder will have a different opinion.

The way to fix things is to open the build settings for your target and change Product Module Name. Xcode sets it by default to $(PRODUCT_NAME:c99extidentifier), which yields the value "Étoilé", but that name won't work because it has a representation that is different from the one used by Interface Builder. You can fix the issue by writing the module name manually. Under the hood the code points will be the correct ones.

Hoping this helps someone.


Final note: if instead you're creating a new project (as opposed to a new target or renaming a target), then you'll observe something different. The default setting $(PRODUCT_NAME:c99extidentifier) will produce a value of "E_toile_". That's probably because this time the name was extracted from the file system in its decomposed form (using a combining character), and the combining characters are replaced by underscores. That module name, even though it's ugly, will work fine with Interface Builder.

This is heavily related to SR‐10839, though in this case there is more in play with Xcode and Interface Builder added to the mix.