私はコルドバで localNotifications を実装しようとしてきましたが、古いプラグインがたくさん見つかりましたが、完全に最新のものはありませんでした。コルドバ ソースで localNotifications が処理され、すべてのリスニング プラグインにブロードキャストされていることに気付きました。
// repost the localnotification using the default NSNotificationCenter so multiple plugins may respond
- (void) application:(UIApplication*)application
didReceiveLocalNotification:(UILocalNotification*)notification
{
// re-post ( broadcast )
[[NSNotificationCenter defaultCenter] postNotificationName:CDVLocalNotification object:notification];
}
ただし、プッシュ通知には同様の処理はありません。phongap-build プッシュ通知プラグインは、「メソッド スウィズリング」と呼ばれるものを使用して、AppDelegate.m に追加のメソッドを追加します。
標準の AppDelegate は両方を実行するか、どちらも実行しないように思われますか、それとも多くのプラグインがそれらをリッスンする可能性があることを意味するローカル通知に関する基本的なものがありますか?
コルドバが投稿する通知をリッスンするプラグインを作成する方法の例はありますか? 私が見つけた localNotifications プラグインはすべて、セットアップの一環として AppDelegate.m ファイルを手動で変更するように指示しています。