You need to have something like:
NSString *myCallbackId;
as an instance level variable (outside of any method, so it retains its value). Install it when you first enter the plugin code:
myCallbackId = command.callbackId;
Then, immediately after creating the PluginResult instance, but before using it, do the following:
[pluginResult setKeepCallback:[NSNumber numberWithBool:YES]]
This will say that it will support a callback for future use.
Then do something like:
[self.commandDelegate sendPluginResult:pluginResult callbackId:myCallbackId]
source share