科尔多瓦发出警告称为“线程警告:[你的功能]花了[n] ms。 "在iOS中 [英] Cordova shows an warning as " THREAD WARNING: [Your function] took [n] ms. " in iOS

查看:240
本文介绍了科尔多瓦发出警告称为“线程警告:[你的功能]花了[n] ms。 "在iOS中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

运行 iOS Phonegap 项目时。类似地,对于一些剩余的插件,如地理位置和文件系统。

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

由于我是Phonegap的新手,可以请任何人告诉我如何在后台线程上运行插件。

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

我也检查了这个

我们可以忽略此线程警告,还是与iOS Phone-gap中的内存问题有关

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

谢谢

推荐答案

根据这个。解决了我的警告问题

As per this. solved my warning issue

我发现警告可以被忽略。但这可以通过使用这个循环添加后台线程来解决:(在CDVLogger.m中)

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

这篇关于科尔多瓦发出警告称为“线程警告:[你的功能]花了[n] ms。 "在iOS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆