gitawego / cordova-screenshot

screenshot plugin for cordova/phonegap
Other
211 stars 168 forks source link

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

Open jacop85 opened 8 years ago

jacop85 commented 8 years ago

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

jacop85 commented 8 years ago

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

pke commented 8 years ago

can this be made as PR?

jacop85 commented 8 years ago

ASAP :)