线程警告在Phonegap / Cordova应用程序 [英] thread warnings in Phonegap/Cordova app

查看:122
本文介绍了线程警告在Phonegap / Cordova应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone(iOS 6)上收到这两个线程警告编译:

I am getting these two thread warnings compiling on an iPhone (iOS 6):

THREAD WARNING: ['InAppBrowser'] took '260.519043' ms. Plugin should use a background thread.
THREAD WARNING: ['Geolocation'] took '110.953857' ms. Plugin should use a background thread.

这是我如何调用我的代码中的插件:

this is how I call the plugins in my code:

window.open("http://www.anaddress.com", '_system');

这是我的config.xml的样子:

and this is how my config.xml looks like:

<?xml version='1.0' encoding='utf-8'?>
<widget id="my.id" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Hello Cordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <access origin="*" />
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="EnableViewportScale" value="false" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="FadeSplashScreenDuration" value=".25" />
    <preference name="HideKeyboardFormAccessoryBar" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="KeyboardShrinksView" value="false" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="ShowSplashScreenSpinner" value="true" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="TopActivityIndicator" value="gray" />
    <preference name="GapBetweenPages" value="0" />
    <preference name="PageLength" value="0" />
    <preference name="PaginationBreakingMode" value="page" />
    <preference name="PaginationMode" value="unpaginated" />
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <feature name="Notification">
        <param name="ios-package" value="CDVNotification" />
    </feature>
    <feature name="Geolocation">
        <param name="ios-package" value="CDVLocation" />
    </feature>
    <feature name="InAppBrowser">
        <param name="ios-package" value="CDVInAppBrowser" />
    </feature>
    <author email="mail@exam.de" href="http://www.example.com">Me
    </author>
    <content src="index.html" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
</widget>

当然,我使用cordova CLI安装了插件:

Of course I installed the plugins using the cordova CLI:

$ cordova plugin add org.apache.cordova.inappbrowser

任何帮助都会感激。

推荐答案

查看 Phonegap Documentation 并搜索Threading
他们解释你可能想在后台运行线程而不是主要的。

Look at the Phonegap Documentation and search for "Threading" They explain that you might want to run the thread in the Background instead of the main one.

苹果不喜欢阻止的UI,所以你需要找到一个方法来取消你的电话,如果它需要超过10毫秒。

Apple doesn't like Blocked UI so you need to find a way to cancel your call if it takes more than 10 milliseconds.

虽然你不会收到错误,只是警告。

Although you are not getting errors, just warnings.

这篇关于线程警告在Phonegap / Cordova应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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