Phonegap插件 - 将行添加到应用程序代理 [英] Phonegap Plugin - append lines to app delegate

查看:170
本文介绍了Phonegap插件 - 将行添加到应用程序代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个phonegap插件。到现在为止还挺好。
现在我想通过config.xml在AppDelegate.m中添加1或2个方法,这样它就会自动为开发人员填充。
是可能吗?

I'm developing a phonegap plugin. So far so good. Now I would like to append 1 or 2 methods to the AppDelegate.m through the config.xml so it will be populated for the developer automatically. Is it possible?

谢谢。

推荐答案

查看推送插件,他们为appDelegate使用了目标c类别

take a look into the Push Plugin, they use an objective-c category for the appDelegate

https://github.com/phonegap-build/PushPlugin

如果您只是想在应用程式启用时收到通知,需要更改AppDelegate上的任何内容,只需将其放在您的插件上:

If you just want to be notified when the app becomes active you don't need to change anything on the AppDelegate, just put this on your plugin:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; 

- (void)onAppDidBecomeActive:(NSNotification*)notification
{

     NSLog(@"%@",@"applicationDidBecomeActive");

}

这篇关于Phonegap插件 - 将行添加到应用程序代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆