私は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.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(){plugin()。runNotification(); }...私の新しいメソッド
..。
私は自分のDistributedNotification.mm
クラスを
Build Phases -> "Compile Sources"
私のプラグインターゲット用。しかしrunNotification
、(私のWebページで)My new method
リンクをクリックしても何も起こらないため、メソッドが呼び出されているかどうかはわかりません。