passing uiwebview form data to objective c
I am using phonegap to load a web application. The application has a form. I would like to capture this form data and pass it to objective c so that I can create a local apple push notification.
I am having trouble understanding howto capture this form data. Any help wo开发者_如何学编程uld be greatly appreciated.
Thanks, Peter
I think you will want to create a plugin to achieve this functionality. Some examples of plugins are here: https://github.com/phonegap/phonegap-plugins. Note that there has been a push notification plugin made by Urban Airship that you could use or at least use for inspiration: http://blog.urbanairship.com/blog/2010/06/09/phonegap-push/
In general what you need to do is create an objective-c class that extends PhoneGapCommand and has a method that does the push notification work. Then in your html page you need to capture the onsubmit event of the form and call PhoneGap.exec(MyClass.myMethod", args) in you JavaScript code where args is a simple hash of name-value pairs from your form.
精彩评论