I’m developing on an older Mac. I don’t have access to newer Macs running Xcode 3.1, but I want to make sure my sourcecode will work on them. It’s been pretty easy so far, all I have to do is ignore anything with “deprecated” next to its name, but the change from NIBs to XIBs has me kind of tripped up. The things I’ve read seemingly imply that XIBs get compiled into NIBs during a Release build, but maybe they don’t during a Debug build.
What would this do in Xcode 3.1?
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
[NSBundle loadNibNamed:@"MainMenu" owner: NSApp];
[[NSApp mainMenu] removeItem: [[NSApp mainMenu]itemWithTitle: @"File"]];
[pool release];
[NSApp run];
return NSApplicationMain(argc, (const char **) argv);
}
Fail in Debug because MainMenu.nib doesn’t exist? Or are XIBs turned into NIBs every time an application compiles, period, and I don’t have to worry about any of this?
XIBs are always compiled into NIBs for use at runtime. XIB is just an XML-based storage format. The NIBs produced by compiling the XIBs do not contain the information needed to edit the NIB file: a XIB compiles to a read-only NIB. This does not affect how your application uses them at all: as far as it’s concerned, a NIB is a NIB is a NIB.