NSBundle classNamed: Problem
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.