"" bundle 因为 bundle 还没有加载 - 空的 bundle name

"" bundle because the bundle has not been loaded - Empty bundle name

我正在尝试加载笔尖,但不断出现以下错误:

-[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

}

谢谢

好的,

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