I have an existing App in the AppStore and I am building a POC AppClip for it. I have created the AppClip (using storyboards) and I am trying to reuse classes from the main App in Xcode. I have custom UILabels and UIButtons (including custom UIColor and UIFont). I have added those classes to the target membership of the AppClip. When I build the view in the storyboard, everything looks exactly how I want. All of the IBDesignables work as expected. When I build the AppClip and run it in a simulator, it runs but without my custom classes. So my Labels look like generic UILabels and my buttons look like generic UIButtons.
I have double checked all of my outlets in my view controller and everything is setup correctly. I do get the key value coding error for every label and button on the screen.
Failed to set (labelColor) user defined inspected property on (UILabel): [<UILabel 0x7fa9d2406ee0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key labelColor.
How do I share classes between my main app and the AppClip at runtime? Do these need to be explicitly included somehow?
UPDATE: I believe the issue is that my Custom XXLabel & XXButton & XXColor & XXFont Classes are not included when the appclip builds. I have added references to those files to the appclip and I have added those files to the build phases of the appclip project settings.
The app still loads my labels as UILabels and not XXLabels (some with UIButton).
This isn't necessarily a problem with outlets, you can get this message if a user defined runtime attribute is invalid.
Try searching your project/workspace for
labelColor. If it appears on a storyboard, it'll show up in the results. Click the search result to navigate to the offending view component.Example
I've set an invalid attribute on a UIView
It crashes
[<UIView 0x7fa8c5f3f200> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key notAProperty.