🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by Chris Conley Wed, 23 Dec 1992 04:53
loading code dynamically with NXBundle
#1945
Author: Chris Conley
Date: Wed, 23 Dec 1992 04:53
56 lines
2311 bytes
Greetings little elves, all busy toiling away on MCCA's,

I have a quick question,  :) , about dynamically loading classes using
NXBundle.

The bundle directory from which I would like to load is separate from my
main bundle.  This bundle directory consists of an interface file, 
PositioningMap.nib (inside the English.lproj dir), executable code, 
PositioningMap, and a tiff file.  The whole bundle directory is called
PositioningMap.framework.  The executable code is made up of a single class
called PositioningMap, a view subclass.

I made PositioningMap.m the nib file's owner.  Everything compiles fine
as a bundle in ProjectBuilder.

From my application, I can load the nib file, but for some reason I can't get
it to load in the PositioingMap view.  In the console, it says:

Dec 22 22:02:07 localhost ConceptBoard[3348]: objc: class `PositioningMap' 
not linked into application

Here's a snippet of code:

// The following seems to work fine
if (myBundle = [[NXBundle alloc] initForDirectory:bundlePath]) {
	printf("Seem to have gotten myBundle OK\n");
}
	
// This does not give me the Celebrate message 	
classObj = [[[myBundle classNamed:PositioningMap] alloc] initFrame:NULL];
		if (classObj) {
			printf("Celebrate good times, c'mon...\n");
		}

// And the following seems to work
if ([myBundle getPath:buf forResource:"PositioningMap" ofType:"nib"]) {
		
	loadedNib = [NXApp loadNibFile:buf owner:NXApp withNames:NO 
				fromZone:[NXApp zone]];
    }

This is when I get the `PositioningMap' not linked into application message
on the Console.

Any comments back would be appreciated.  This is for a Thesis demonstration.
If the the question seems trivial, please forgive, I'm a designer, not
a CS guru...


Merry Holidays,

Chris Conley
Institute of Design, IIT

thsscvc@iitmax.iit.edu
Re: loading code dynamically with NXBundle
#1949
Author: Louis A. Mamakos
Date: Wed, 23 Dec 1992 14:04
30 lines
1474 bytes
In article <1992Dec23.045347.19934@iitmax.iit.edu> thsscvc@iitmax.iit.edu (Chris Conley) writes:

>Dec 22 22:02:07 localhost ConceptBoard[3348]: objc: class `PositioningMap' 
>not linked into application

>// The following seems to work fine
>if (myBundle = [[NXBundle alloc] initForDirectory:bundlePath]) {
>	printf("Seem to have gotten myBundle OK\n");
>}

This looks to be the problem here.

>// This does not give me the Celebrate message 	
>classObj = [[[myBundle classNamed:PositioningMap] alloc] initFrame:NULL];
>		if (classObj) {
>			printf("Celebrate good times, c'mon...\n");
>		}

What I do, which seems to work just fine, is something like this:

classObj = [[[myBundle principalClass] alloc] initFrame:NULL];

Also, you're invoking the classNamed: method incorrectly;I think that
this will work too:

classObj = [[[myBundle classNamed:"PositioningMap"] alloc] initFrame:NULL];

classNamed: take the *name* of the class, not a Class reference.

louie
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads