• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How can a plug-in bundle get access to its own resources?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can a plug-in bundle get access to its own resources?


  • Subject: Re: How can a plug-in bundle get access to its own resources?
  • From: Mike Abdullah <email@hidden>
  • Date: Sun, 15 Nov 2009 14:28:44 +0000


On 15 Nov 2009, at 11:36 AM, Motti Shneor <email@hidden> wrote:

Thanks, but the bundleWithIdentifier has its own problems.

1. The identifier is (as far as i know) accessible only from the bundle itself, which I don't have! I'm circling around here, without access to my own resources! Must I hard-code the bundle identifier as a string constant within each of my plug-ins?

If you want to use that method, yes

2. Even if I DO follow this rule, how can I manage to distinguish between two bundles that include the same plug-in but from different versions?


They have the same class, and the same identifier!!!!


Really, Isn't there a way for a library (dll, dylib framework etc) to know what is its containing bundle?

As already explained to you, having the same class loaded twice is a really bad idea. You have an API that does exactly what you want (bundleForClass:) — now fix your code not to re-use class names


On 10/11/2009, at 19:42, Douglas Davidson wrote:


On Nov 10, 2009, at 4:59 AM, Motti Shneor wrote:

Thanks guys, but you may have not read all my message ---

The [NSBundle bundleForClass:[self class]];

is unusable for me, because I have many plugins that build from the
same code, and export the same class (of course --- the same class
name).

Obj-C has no name-spaces, and so, If you load 2 such plugins, and
use the [NSBundle bundleForClass:[self class]] in each of them
independently --- you'll get erroneous answers! both of them will
return the same bundle although they come from different bundles.

This is hardly a system "bug" because there are no namespaces, and
for the same class name there is only one bundle.

As others have said, don't do this. However, to answer your question,
the other way to locate your bundle is via bundleWithIdentifier:.


Douglas Davidson


Motti Shneor ------------------------------------------ Senior Software Engineer Waves Audio ltd.

Phone: +972-3-6094415
Mobile: +972-54-4470730
[mailto: email@hidden]



_______________________________________________

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
_______________________________________________

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


References: 
 >How can a plug-in bundle get access to its own resources? (From: Motti Shneor <email@hidden>)
 >Re: How can a plug-in bundle get access to its own resources? (From: Benjamin Miller <email@hidden>)
 >Re: How can a plug-in bundle get access to its own resources? (From: Kiel Gillard <email@hidden>)
 >Re: How can a plug-in bundle get access to its own resources? (From: Motti Shneor <email@hidden>)
 >Re: How can a plug-in bundle get access to its own resources? (From: Douglas Davidson <email@hidden>)
 >Re: How can a plug-in bundle get access to its own resources? (From: Motti Shneor <email@hidden>)

  • Prev by Date: jdns_sd.dll ??? Bonjour & Cocoa OK, but .... Bonjour & Java & Windows??? - need help!
  • Next by Date: Sync my iPhone app with the Desktop version
  • Previous by thread: Re: How can a plug-in bundle get access to its own resources?
  • Next by thread: Re: How can a plug-in bundle get access to its own resources?
  • Index(es):
    • Date
    • Thread