“”捆绑,因为捆绑包尚未加载 - 空捆绑包名称

时间:2016-05-13 16:52:39

标签: cocoa nsviewcontroller

我正在尝试加载一个笔尖,但不断收到以下错误:

-[NSViewController initWithCoder:] could not instantiate an NSViewController for a nib in the "" bundle because the bundle has not been loaded.

缺少捆绑包名称......会导致什么原因?

func collectionView(collectionView: NSCollectionView, itemForRepresentedObjectAtIndexPath indexPath: NSIndexPath) -> NSCollectionViewItem
{

    let item = collectionView.makeItemWithIdentifier("MyNib", forIndexPath: indexPath) // Crashes here

}

由于

1 个答案:

答案 0 :(得分:1)

确定,

这是因为没有在NSCollectionViewItem对象上设置NibName和NibBundle。