Sujania Sujania - 1 year ago 224
iOS Question

THREAD WARNING: [Your function] took [n] ms. Plugin should use a background thread

"THREAD WARNING: ['Console'] took '81.661865' ms. Plugin should use a background thread."

While running iOS Phonegap project. Similarly for some of the remaining plugins like geolocation and filesystem.

As I am new to Phonegap ,can please anyone tell me how can I run the plugin on background thread.

I have checked this also.

Can we ignore this thread warning or is it related to memory issue in iOS Phone-gap


Answer Source

As per this. solved my warning issue

I found warning can be ignored .But this can be solved by adding background thread using this loop:(In CDVLogger.m)

 [self.commandDelegate runInBackground:^{

    //add your code here

Now this looks as below for console warning:

- (void)logLevel:(CDVInvokedUrlCommand*)command
   [self.commandDelegate runInBackground:^{
   id level = [command argumentAtIndex:0];
   id message = [command argumentAtIndex:1];

  if ([level isEqualToString:@"LOG"]) {
    NSLog(@"%@", message);
  } else {
      NSLog(@"%@: %@", level, message);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download