Re: Getting classes from bundles in an array
Re: Getting classes from bundles in an array
- Subject: Re: Getting classes from bundles in an array
- From: Rainer Brockerhoff <email@hidden>
- Date: Thu, 15 Aug 2002 13:19:06 -0300
>
Date: Thu, 15 Aug 2002 01:36:35 -0700
>
From: David Newberry <email@hidden>
>
>
This is kind of an odd question... I'm afraid I'm doing something weird
>
but I can't figure it out. What I'm doing is adding all the bundles in a
>
directory to an array, then later iterating through the array and trying
>
to get the class in each bundle with a particular name. The odd behavior
>
is that I only seem to be able to get the class from the last item added
>
to the array.
>
...
>
The only thing I'm doing with the array is this within a loop:
>
>
plugin = [plugins objectAtIndex:index];
>
pluginClass = [plugin classNamed:@"BEPlugin"];
Each plug-in must use different class names, as there's a single application-wide namespace for the ObjC runtime. If you use the same one, as you do here, every class overwrites the previous one, so only the last one works.
So, the best way is to use the NSPrincipalClass item in each bundle's plist, and have that contain the actual class name for each plug-in. But they _must_ all be different. Look at my article at:
http://cocoadevcentral.com/tutorials/showpage.php?show=00000059.php
for actual code samples.
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"I love deadlines. I love the whooshing noise they make as they go by" (Douglas Adams)
http://www.brockerhoff.net/ (updated July 2002)
_______________________________________________
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.