Re: Loading external code
Re: Loading external code
- Subject: Re: Loading external code
- From: Ondra Cada <email@hidden>
- Date: Tue, 28 May 2002 22:21:48 +0200
On Tuesday, May 28, 2002, at 09:47 , Thilo Ettelt wrote:
Vars: NSBundle *aBundle, Class aClass, id trayClass
I would consider renaming trayClass to trayInstance (or just tray, or
whatever), but that's unimportant from the behaviour POV.
aBundle = [[NSBundle alloc] initWithPath:thePath];
bundleWithPath: might be better. No real harm though, just a possible leak
if an exception is triggered before releasing it.
if (aClass = [aBundle principalClass]) {
trayClass = [[aClass alloc] init];
autorelease would be better, for the same reason
[allTrays addObject:trayClass];
[trayview addSubview:[allTrays objectAtIndex:i]];
[allTrays objectAtIndex:i] looks somewhat strange here. Though I dunno the
algorithm, so might be perfectly right. Even if wrong, should not cause
problems of the kind you observe.
NSLog(@"%@",allTrays);
[trayClass release];
See above.
if (![[allTrays objectAtIndex:i] view]) {
NSLog(@"There is no view");
}
}
[aBundle release];
See above.
When the code goes further....
and I call [window close] (window is an outlet in my maincontroller and
there's no equal outlet in the loaded code) PB tells me that the selector
[tray window] (tray is the principas class of the external bundle) was
not recognized.
Hmmm. Presumed you you actually meant the runtime (PB has nothing to do
with that) complained that -[tray *close*] was not recognized, I'd guess
the window it gets (auto)released somewhere, and thus next created tray
just happens to occupy its place in memory -- getting so the next message
sent to "window".
So far as I can say, there seems to be no problem in the loading itself.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.