Re: Plugin Information
Re: Plugin Information
- Subject: Re: Plugin Information
- From: Uli Kusterer <email@hidden>
- Date: Mon, 14 Apr 2008 10:45:45 +0200
Am 14.04.2008 um 08:30 schrieb Rick Langschultz:
My application uses plugins from a support folder in /Library/
Application Support/AppName/Plugins/. The application searches this
folder for all the plugins and loads them. But here is my dilemma: i
want to put the plugin class name as the bundle identifier so that i
can call methods from those classes when something in the main
application is triggered.
You're not really making sense here: You can set the bundle
identifier in the "Properties" tab of the Target Info window in Xcode.
There's also a field for the principal class name. You really do not
want to force the bundle identifier and class name to be the same.
That's not the purpose of these two fields. The bundle ID is for
uniquely identifying a plugin, not just across all plugins for your
app, and not just across all developers who might write plugins for
your app (so that e.g. Microsoft's 'Load WMF file' plugin can be
distinguished from your own), but also across all plugins on a
particular Mac, no matter what app they're for. Using a class name as
a bundle ID is asking for collisions, and someone is bound to look up
the wrong bundle and try to load the wrong kind of file. Don't abuse
the bundle ID.
For instance, I have a plugin called A.plugin, B.plugin, and
C.plugin with Principal Classes named APluginClass, BPluginClass,
and CPluginClass respectively. They conform to AppNameProtocol which
has an installation, allocation/init, dealloc, and other class names.
My code uses NSString *bundlePath, and NSBundle *bundle. I want to
have something like *bundlePathA, *bundlePathB, etc; and *bundleA,
*bundleB, *bundleC. Is there a simple way that I can do this?
Do what? If you mean, look up a bundle based on its class name, then
you can use an NSDictionary to associate class name with NSBundle
objects. This also works for the other way round, but in that case you
could just use the principalClass method of a particular NSBundle
object.
Does that help? If not, it may help to illustrate what you're having
trouble with by giving us more information, in particular giving us a
concrete example of what you're trying to do, plus maybe even code
that illustrates the problem.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden