tags:

views:

49

answers:

1

Ok, Now I want to add a menu in the safari menubar. I Create a Cocoa bundle project in Xcode .and then change the target extension is "webplugin" .and then add WebPluginMIMETypesFilename com.example.webplugin.plist to the info.plist.but I don't know the is right?. I make the prinpical class is my main plugin class SafariPlug . and then In the safariPlug.m I implement the methods:

// This method returns an NSView object that conforms to the WebPlugIn informal protocol.

  • (NSView *)plugInViewWithArguments:(NSDictionary *)arguments

{

return [[[self alloc] initWithArguments:arguments] autorelease];

}

  • (id)initWithArguments:(NSDictionary *)arguments

{

self = [super init];

if (self) 
    [MenuController sharedController];  // trigger the menu items to be added

return self;

}

at the end I followed the url:run safari to debug plunIn project

add a debug bundle:myProject.webplugin into the folder:/library/internet plug-ins/
But when I make a breakpoint into the

  • (NSView *)plugInViewWithArguments:(NSDictionary *)arguments

the program didn't load in the debug mode? SomeOne which have experience can tell me the step of add a menu into the safari? Thank you very much!

+4  A: 

Safari will not load your plugin unless you load a webpage that references your plugin. So I'm afraid the plugin type you're working on is not officially supported, by the current plugin API of safari.

You can use SIBML to write this kind of plugin. But SIMBL is not something officially supported by Apple, and a lot of people consider it a hack.

mfazekas
Now I want to make a safari plugin with simbl , and I have read the Armchair Guide To Cocoa Reverse Engineering. but when implement the method - (void)load; how to use the plugin to get the safari DOM object ,just like PIC or Flash URL ? Thank you very much !
jin