Plug-in that fires callback events after initial call to instantiate.

  • 1
  • Question
  • Updated 8 years ago
I have a device that plugs into the iPhone.

I have written a plug-in with functions open and close to initializes and open the device and close it and clean up resources.

These work great and even the data being captured is working and I am seeing it with NSLog out puts.

I am having a problem getting this data back the java script.

I pass in a callback function in the open function in the success parameter and want to somehow save this so I can fire this callback anytime data is read from the device so the phone gap application can use that data.

I tried saving the callback to a global variable in the class, but always get a EXC_BAD_ACCESS error.

Anyway to save the callback so it can be called on anytime the device acquires data?
Photo of Shawn Bigger

Shawn Bigger

  • 3 Posts
  • 0 Reply Likes

Posted 8 years ago

  • 1
Photo of Shazron

Shazron, Developer Level 42

  • 37 Posts
  • 2 Reply Likes
Please post the crash log. This may be a threading issue. Try wrapping a


setTimeout(function() {
// your JavaScript here
}, 0);


around your JavaScript code that you pass to the webview.