Nibs sometimes get compiled with lowercase modulename, causing crash

Originator:skagedal
Number:rdar://38019922 Date Originated:01-Mar-2018 11:04 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Version 9.2 (9C40b)
Classification:Serious Bug Reproducible:Sometimes
 
Summary:
In my project, when setting a custom class for a view in Interface Builder and keeping the default “Inherit Module From Target”, the app will crash like this:

2018-03-01 10:44:06.191809+0100 TargetName[75262:2191024] Unknown class _TtC7appname26TopContentViewWithoutGraph in Interface Builder file.
2018-03-01 10:44:06.259342+0100 TargetName[75262:2191024] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x7febc5e76670> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key buttonContainerHeightConstraint.'

To protect the client, I’ve renamed specific words. The module is called “APPName”, but in the compiled nib, it seems to be pointing to a symbol containing “appname”, which I think is what is causing the crash. The line that compiles the Nib looks like this:

CompileXIB Main/Views/TopContentViewWithoutGraph.xib
    cd /Users/simon/code/appname-ios/app
    export PATH="/Applications/Xcode/Xcode-9.2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode/Xcode-9.2.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode/Xcode-9.2.app/Contents/Developer/usr/bin/..
    /Applications/Xcode/Xcode-9.2.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --module appname --output-partial-info-plist /Users/simon/Library/Developer/Xcode/DerivedData/APPName-gojknyfwzriukldevdemryowfsoh/Build/Intermediates.noindex/APPName.build/Debug-iphonesimulator/Target\ Name.build/TopContentViewWithoutGraph-PartialInfo.plist --auto-activate-custom-fonts --target-device iphone --minimum-deployment-target 10.0 --output-format human-readable-text --compile /Users/simon/Library/Developer/Xcode/DerivedData/APPName-gojknyfwzriukldevdemryowfsoh/Build/Products/Debug-iphonesimulator/TargetName.app/TopContentViewWithoutGraph.nib /Users/simon/code/appname-ios/app/Main/Views/TopContentViewWithoutGraph.xib

As you see, there is a ‘—module appname’ there. In other calls to ibtool, like a storyboard, I see the correct ‘—module APPName’. 

Steps to Reproduce:
I was unable to reproduce this in a simple project.

Expected Results:
Pass the correct module name and don’t crash. 

Actual Results:
Pass wrong module name and crash. 

Version:
Version 9.2 (9C40b) 

Notes:
Workaround is to uncheck “Inherit module from target”, which fills in APPName for me explicitly and works.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!