Search code examples
cocoansviewcontroller

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


I'm trying to load a nib, but keep getting the following error:

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

The bundle name is missing...what would cause that?

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

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

}

Thanks


Solution

  • Ok,

    It was because the NibName and NibBundle were not set on the NSCollectionViewItem object.