3
votes

We are experimenting with delivering our nibs in language specific bundles. For a couple of different reasons this would help us out.

My questions are around setting up a resource only bundle.

  1. When I add a new bundle in xcode through the “New Project - Framework & Library - Bundle” menu xcode will add a new xcodeproj file. Is this correct? I thought a bundle was just a directory with a .bundle extension.
  2. If I want to only have nib files in my bundle do I still need an executable file and a info.plist file?

So far I have manually created a bundle directory and added nib files. I and can access it with

NSBundle bundleWithPath

Not sure if it's loaded correctly, but the bundleWithPath method does not return nil.

But when I try to open a nib file from the bundle I get the following error:

* Terminating app due to uncaught exception 'NSInternalInco nsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (not yet loaded)' with name 'Nib''

And I have added the bundle to "Copy Bundle Resources".

Thanks for any info. I'm sure I'm making this harder than it should be.

EDIT: I went back and for a test added the line below to look for the xib instead of the nib. It works for xib but not for nib. I think this means that that the xib maybe is not getting compiled.

[languageBundle pathForResource:@"TestNib" ofType:@"xib"];

1

1 Answers

0
votes
  1. No, this is not correct. You should add a new target to your current project instead of creating a new project.

  2. You don't need an executable, but you will probably need an Info.plist for it to be a proper bundle (it might not be strictly necessary, but it won't hurt to have one).

Now, is there a reason you're putting your nib files in a bundle instead of in .lproj directories? Also, you'll need to show some of your actual code before we can offer further help.