. . . but the plug-in failed to load successfully.

I was hacking around with WebKit plug-ins this weekend, and ran into a frustrating issue. Initially, I had gotten my plug-in working, with a single object (the plug-in) in the bundle. However, after adding a second object to the bundle, the plug-in stopped loading. All I the info I could get out of Safari/WebKit was the unhelpful dialog displayed below:

A screenshot of a Safari browser window, displaying an error dialog.

After some digging around, comparing my project to the example plug-ins that ship with XCode, I discovered I was missing the NSPrincipalClass key in my bundle's Info.plist. After adding the definition:

<key>NSPrincipalClass</key>
<string>MyPlugIn</string>
the plug-in loaded without issue. AFAICT, the introduction of the new class created an ambiguity for the plug-in manager as far as what class should be instantiated as the plug-in implementation.