比方說,我有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.
謝謝您的回答@MathewS。在我的具體案例中,問題是「FancyLabels」框架正在使用預建的Carthage框架。我設法在不使用空白/空白工作區的情況下也能正常工作。看看我的答案中的github鏈接。 –