C++ Firebreath如何知道是否在没有调试的情况下调用了我的方法

C++ Firebreath如何知道是否在没有调试的情况下调用了我的方法,c++,objective-c,firebreath,C++,Objective C,Firebreath,我在firebreath项目中使用Objective-C++。问题是我使用的是Xcode 4,无法找到调试项目的方法。因此,我考虑了是否从web页面调用了我的方法。 以下是我的源代码: 在我的OpenOnDesktopPluginAPI.h类中: class OpenOnDesktopPluginAPI : public FB::JSAPIAuto { public: OpenOnDesktopPluginAPI(const OpenOnDesktopPluginPtr&

我在firebreath项目中使用Objective-C++。问题是我使用的是Xcode 4,无法找到调试项目的方法。因此,我考虑了是否从web页面调用了我的方法。 以下是我的源代码: 在我的
OpenOnDesktopPluginAPI.h
类中:

class OpenOnDesktopPluginAPI : public FB::JSAPIAuto
{
    public:
    OpenOnDesktopPluginAPI(const OpenOnDesktopPluginPtr& plugin, const FB::BrowserHostPtr& host);
    virtual ~OpenOnDesktopPluginAPI();
    OpenOnDesktopPluginPtr getPlugin();
   ...
   //This is my method 
   void runNotification();
   ...
};
OpenOnDesktopPluginAPI::OpenOnDesktopPluginAPI(const OpenOnDesktopPluginPtr& plugin,     const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    ...
    //Register my method
    registerMethod("runNotification",  make_method(this, &OpenOnDesktopPluginAPI::runNotification));
    ...
}
在我的
OpenOnDesktopPluginAPI.mm
类中:

class OpenOnDesktopPluginAPI : public FB::JSAPIAuto
{
    public:
    OpenOnDesktopPluginAPI(const OpenOnDesktopPluginPtr& plugin, const FB::BrowserHostPtr& host);
    virtual ~OpenOnDesktopPluginAPI();
    OpenOnDesktopPluginPtr getPlugin();
   ...
   //This is my method 
   void runNotification();
   ...
};
OpenOnDesktopPluginAPI::OpenOnDesktopPluginAPI(const OpenOnDesktopPluginPtr& plugin,     const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    ...
    //Register my method
    registerMethod("runNotification",  make_method(this, &OpenOnDesktopPluginAPI::runNotification));
    ...
}
//DistributedNotification类是我的objective-c类,它实现了发布分布式通知

void OpenOnDesktopPluginAPI::runNotification()
{
     DistributedNotification * notificationClass = [[DistributedNotification alloc] init]; 
    [notificationClass postNotification];
    [notificationClass release];
}
在my
FBControl.html
中: ... 函数myFunction() { plugin().runNotification(); } ... 我的新方法

我将我的
DistributedNotification.mm
类放在

 Build Phases -> "Compile Sources"
对于我的插件目标。
但是我不知道是否调用了我的
runNotification
方法,因为当我(在我的网页中)单击
mynewmethod
链接时,什么都没有发生。

当你问我时,我会重复我在论坛上说的话;也许你还没有看到这个答案:

首先,至少在某些浏览器上,您可以使用Xcode4进行调试;诀窍在于找出要连接到哪个进程

其次,您可以始终使用NSLog将事情记录到控制台。第三,可以使用log4cplus(参见)

最后,您还没有指定要测试的浏览器,也没有指出会发生什么。这看起来很合理,但不合适吗?什么不起作用?它有什么作用


如果没有你所遇到的详细信息,几乎不可能给你任何有用的建议。

在代码中加入好的旧痕迹?我使用的是firefox 3.6.23和Chrome 14.0.835.202。当我点击“我的新方法”链接中的网页时,它调用javascript函数“myFunction”。这个函数调用插件方法“runNotification”。在这个方法中,我有objective-c代码。特别是我发布了一个NSDistributedNotification。我的问题是通知从未发布。现在javascript控制台给我一条错误消息:“plugin()。通知不是函数”。听起来你的插件没有加载;您确定安装正确吗?它是否出现在关于:插件?首先尝试让FBTestPlugin工作,以确保您了解如何加载和运行插件。我的插件正在工作。如果我看“关于:插件”,它会显示我的插件。加载FBControl.html页面时,我可以看到“Plugin loaded!”警报消息。此外,默认功能工作正常。我找不到错误:(等待…plugin()。通知不是一个函数?根据您的代码,plugin()。runNotification应该是一个函数。我看不到示例代码中定义了“通知”的任何地方。如果出现插件加载的警报消息,则plugin()可能有问题函数。我建议停下来到IRC房间寻求进一步帮助;这已经超出了此问题的范围。或者,打开一个与您所了解的新问题相关的新问题,因为日志记录/调试问题已得到回答。