• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Framework Nibs Not Loading 10.4 to 10.3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Framework Nibs Not Loading 10.4 to 10.3


  • Subject: Re: Framework Nibs Not Loading 10.4 to 10.3
  • From: Kirk Kerekes <email@hidden>
  • Date: Tue, 24 May 2005 09:33:06 -0500

For various reasons, [NSBundle bundleForClass:] is not particularly reliable, particularly if the bundle is a framework. I'll let someone who knows the internal differences in bundle-loading between 10.3 and 10.4 chime in as to why, and I will restrict myself to noting what appears to be a good general-purpose solution: [NSBundle bundleWithIdentifier:].

Add a unique bundle-identifier (as in "com.mycompany.myframeworkname") to your framework, and then use that identifier to find the framework bundle.

Note that the structure of a framework is different than the structure of a "regular" bundle, and so some other NSBundle operations don't return particularly useful results -- executablePath, for example (as I recall) returns the path to the _symlink_ to the framework binary.


I am compiling a project in xcode 2.0 / gcc 4.0 which has a cross dev
sdk of 10.3.9 and a deployment target of 10.3 (and so do all of my
embedded frameworks). The problem I am experiencing, is that any nibs
inside these frameworks will load in 10.4 but fail to load when the
application is run under 10.3. Now I just moved this project from
10.3 and it works fine when compiled in an earlier version of xcode.

As an example of what is happening, in one of the embedded
frameworks, there is a class which loads a nib called iub.

- (void)showWindow
{
if (!pvField) {
NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
NSLog(@"thisBundle: %@",[thisBundle description]);
NSString *nibPath = [thisBundle pathForResource:@"iub"
ofType:@"nib"];
NSLog(@"Nib Path: %@",nibPath);
if (![NSBundle loadNibNamed:@"iub" owner:self]) {
NSLog(@"Failed to load iub.nib");
NSBeep();
return;
}
[[pvField window] setExcludedFromWindowsMenu:YES];
[[pvField window] setMenu:nil];
}


     [[pvField window] makeKeyAndOrderFront:self];
}

On 10.4, the console will return

2005-05-22 10:04:08.065 MyApp[15143] thisBundle: NSBundle </Users/
ianmcg/Documents/Cocoa/xcode builds/MyApp.app/Contents/Frameworks/
FinancialFrame.framework> (loaded)
2005-05-22 10:04:08.066 MyApp[15143] Nib Path: /Users/ianmcg/
Documents/Cocoa/xcode builds/MyApp.app/Contents/Frameworks/
FinancialFrame.framework/Resources/iub.nib

On 10.3.9 the console will return

2005-05-22 10:04:08.065 MyApp[487] thisBundle: NSBundle </Users/
ianmcg/Documents/Cocoa/xcode builds/MyApp.app/Contents/Frameworks/
FinancialFrame.framework> (loaded)
2005-05-22 10:04:08.066 MyApp[487] Nib Path: (null)
2005-05-22 10:04:08.066 MyApp[487] Filed to load iub.nib

So far this appears to be a problem with all nib files, from any
embedded framework. Any ideas?

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Framework Nibs Not Loading 10.4 to 10.3
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Printing my document
  • Next by Date: Re: Dynamic User Interface with Cocoa
  • Previous by thread: Re: Framework Nibs Not Loading 10.4 to 10.3
  • Next by thread: Re: Framework Nibs Not Loading 10.4 to 10.3
  • Index(es):
    • Date
    • Thread