Open leowin opened 8 years ago
plugins function (like searchDocuments) that take much processing time block the apps UI Thread. Please run them in a background thread like so:
- (void)myPluginMethod:(CDVInvokedUrlCommand*)command { // Check command.arguments here. [self.commandDelegate runInBackground:^{ NSString* payload = nil; // Some blocking logic... CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:payload]; // The sendPluginResult method is thread-safe. [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; }]; }
Taken from https://cordova.apache.org/docs/en/3.0.0/guide/platforms/ios/plugin.html
https://github.com/atkjumedia/dcsync/commit/215710aee450f32d8078635977d8a73ef0f9e500
done.
plugins function (like searchDocuments) that take much processing time block the apps UI Thread. Please run them in a background thread like so:
- (void)myPluginMethod:(CDVInvokedUrlCommand*)command { // Check command.arguments here. [self.commandDelegate runInBackground:^{ NSString* payload = nil; // Some blocking logic... CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:payload]; // The sendPluginResult method is thread-safe. [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; }]; }
Taken from https://cordova.apache.org/docs/en/3.0.0/guide/platforms/ios/plugin.html