Re: DockTile sample code, Principal class is "DockTile" ?
Re: DockTile sample code, Principal class is "DockTile" ?
- Subject: Re: DockTile sample code, Principal class is "DockTile" ?
- From: Fritz Anderson <email@hidden>
- Date: Sat, 28 Dec 2013 19:42:07 -0600
On 28 Nov 2013, at 5:13 PM, Eden <email@hidden> wrote:
> In Apple's "DockTile" sample code there is a an app and a dock tile plug-in.
>
> In the DockTilePlugIn-Info.plist, the "Principal class" is valued as "DockTile", but there is no such class-- the class in the source code is "DockTilePlugIn".
>
> Isn't that a mistake? But the thing works anyway? The name of the bundle is "DockTile.docktileplugin", so... does "Principal class" really refer to the name of the bundle? Regardless, I can change the name of the finder file and it still works.
>
> In fact, I can delete the value for "Principal class" and it still works... although I can't be sure the working version of something wasn't cached somewhere...
>
> Probably a foolish question, but this is my first time with loadable bundles, I just want to understand...
The setting in Info.plist is a bug. The reason it works is that when -[NSBundle principalClass] can't find a class from Info.plist, it falls back to "the first class loaded," as determined by the link order of the plugin. As the plugin consists of only one class, the fallback happens to be correct.
Documentation bug filed.
— F
_______________________________________________
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