Phonegap / Cordova应用程序中的线程警告

时间:2013-12-04 08:38:23

标签: iphone cordova warnings

我在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.

这就是我在代码中调用插件的方式:

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

这就是我的config.xml的样子:

<?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安装了插件:

$ cordova plugin add org.apache.cordova.inappbrowser

任何帮助将不胜感激,谢谢!

1 个答案:

答案 0 :(得分:6)

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

Apple不喜欢Blocked UI,因此如果需要超过10毫秒,您需要找到取消通话的方法。

虽然您没有收到错误,但只是警告。