• 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
NSBundle classNamed: Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSBundle classNamed: Problem


  • Subject: NSBundle classNamed: Problem
  • From: Philip Weaver <email@hidden>
  • Date: Sun, 24 Mar 2002 23:59:51 -0600

I'm trying to load a class from an NSBundle. If I use "principalClass:", the principal class loads fine. But if I try to load that same class using "classNamed:", nil is returned.

I'm basically following the example in the NSBundle API. Are there other special, extra secret things that I need to do?

Please help if you've done this before,
Philip


Class theClass;
Class thePrincipalClass;
id theInstance;
NSString *sPath = @"LoaderBundle.bundle";
NSBundle * theBundle = [NSBundle bundleWithPath:sPath];

thePrincipalClass = [theBundle principalClass];
theClass = [theBundle classNamed:@"TestClass"];

NSLog(@"thePrincipalClass: %@", thePrincipalClass);
NSLog(@"theClass: %@", theClass);

if (thePrincipalClass != nil) {
theInstance = [[thePrincipalClass alloc] init];
[theInstance doSomething];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: palettes
  • Next by Date: Re: Problems running UNIX Apps in Cocoa GUI
  • Previous by thread: miscellaneous questions
  • Next by thread: Re: getting bundle ID (was 'getting the bundle name')
  • Index(es):
    • Date
    • Thread