cordova-screenshot icon indicating copy to clipboard operation
cordova-screenshot copied to clipboard

"Plugin should use a background thread" error with IOS build ?

Open jacop85 opened this issue 7 years ago • 3 comments

call screenshot.save function fire this error "Plugin should use a background thread" . help please .

jacop85 avatar Sep 16 '16 15:09 jacop85

i have fixed the problem by adding this Objective C code at the end of Screenshot.m file:

- (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]; }]; }

source: https://cordova.apache.org/docs/en/3.0.0/guide/platforms/ios/plugin.html#iOS%20Plugins_threading

jacop85 avatar Sep 16 '16 15:09 jacop85

can this be made as PR?

pke avatar Oct 08 '16 20:10 pke

ASAP :)

jacop85 avatar Oct 10 '16 07:10 jacop85