THREAD WARNING: ['Camera'] took '290.006104' ms. Plugin should use a background thread
camera, cordova, cordova-plugins, ios, phonegap-plugins
Solution
I'm not sure that you should be concerned about `290ms` but if you are, you can do the following:
Since `navigator.camera.getPicture()` in `Camera.js` is calling the `-(void)takePicture:(CDVInvokeUrlCommand*)command` method in `CDVCamera.m` you will have to add threading there.
Open `CDVCamera.m` and add the following before the first line of `takePicture` method:
[self.commandDelegate runInBackground:^{
end add this after the last line:
}];
so it should look like this:
- (void)takePicture:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
NSString* callbackId = command.callbackId;
NSArray* arguments = command.arguments;
...
...
...
self.hasPendingOperation = YES;
}];
}
Here is a reference for building Cordova plugins using background mode look for THREADING:
Problem
I am building a `Phonegap` app for IOS. I have used `Cordova` camera `plugin` for profile pic upload. My sample code is: ``` navigator.camera.getPicture(that.imageDataSuccessCallback, that.imageDataErrorCallback, { quality: 10, destinationType: 1, encodingType: 0, allowEdit: true, correctOrientation: true, sourceType:0 }); ``` When I click on that particular button I am getting warning as ``` THREAD WARNING: ['Camera'] took '290.006104' ms. Plugin should use a background thread. ``` It is blocking my app. Can any one please suggest how to resolve this issue?