假设我有 2 个框架:
- MyApp.framework
- FancyLabels.framework
MyApp.framework 有一个故事板,它使用来自 FancyLabels.framework 的类。
如果我创建一个链接和嵌入两个框架的应用程序目标,我可以从 MyApp.framework 实例化视图控制器没有问题。
但是,如果我尝试在操场上从 MyApp.framework 实例化一个视图控制器,它就无法从 FancyLabels.framework 中找到类。
我的游乐场代码:
//: Playground - noun: a place where people can play
import UIKit
import MyApp
import FancyLabels
let bundle = Bundle(for: MyAppViewController.self)
let storyboard = UIStoryboard(name: "Main", bundle: bundle)
let vc = storyboard.instantiateViewController(withIdentifier: "MyAppViewController")
let view = vc.view
控制台中的输出:
2017-01-22 19:18:17.016 MyPlayground[98260:3124481] Unknown class _TtC18FancyLabels11StyledLabel in Interface Builder file.
2017-01-22 19:18:17.037 MyPlayground[98260:3124481] Failed to set (styleString) user defined inspected property on (UILabel): [<UILabel 0x7fcf175017c0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key styleString.