Closed jonathantrevor closed 12 years ago
Finally worked it out. The git code seems to span 2 types of callback system in Phonegap and doesn't work perfectly with either.
The argc line is an old-style (I think/hope) way of registering callbacks in Phonegap, as the callbackId scheme contains BOTH the success AND the failure callback references.
Therefore to call the error callback when an error occurs we need to find the error handler and invoke it:
(void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { NSLog(@"didFailToRegisterForRemoteNotificationsWithError:%@", error);
NSMutableDictionary results = [NSMutableDictionary dictionary]; PluginResult pluginResult = [PluginResult resultWithStatus:PGCommandStatus_OK messageAsDictionary:results]; [self writeJavascript:[pluginResult toErrorCallbackString:self.callbackId]];
Not sure how to plug the error into the result dictionary but that isnt critical.
Im not getting the error callback called when a register failure occurs:
The logging statement never gets called, so I assume there's some issue with passing the js callback through.
Here's the register call from the JS side:
Success callback works just fine.