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

时间:2011-10-13 18:48:09

标签: c++ objective-c firebreath

我在firebreath项目中使用Objective-C ++。问题是我使用Xcode 4,我找不到调试我的项目的方法。所以我考虑过是否从网页调用了我的方法。 这是我的源代码: 在我的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.mm课程中:

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];
}

在我的FBControl.html中:     ...     函数myFunction()     {          。插件()runNotification();     }     ...     我的新方法
    ...

我将DistributedNotification.mm课程放在

 Build Phases -> "Compile Sources"

我的插件目标。 但是我不知道我的runNotification方法是否被调用,因为当我(在我的网页中)点击My new method链接时,没有任何反应。

1 个答案:

答案 0 :(得分:0)

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

首先,您可以使用Xcode4进行调试,至少在某些浏览器上是这样;诀窍是找出要连接的进程。

其次,您始终可以使用NSLog将内容记录到控制台。第三,您可以使用log4cplus(请参阅http://www.firebreath.org/display/documentation/Logging)。

最后,您还没有指定您正在测试的浏览器,也没有说明会发生什么。它看起来很合理,但显然不起作用?什么不起作用?它有什么作用?

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

相关问题