【问题标题】:apache cordova ios toast and spinner dialogue issueapache cordova ios toast 和 spinner 对话问题
【发布时间】:2017-02-01 12:14:47
【问题描述】:

我正在开发适用于 android 和 ios 构建的 apache Cordova 应用程序。 在使用 android 时,我添加了不必要的离子键盘。但它没有给Android构建带来任何问题。但是当我使用 ios toast 和 spinner 时,对话不起作用。 另一个项目之一在 ios 和 android build 上运行良好。

  1. 当我从 config.xml 中删除离子键盘时,它根本无法工作。
  2. 当我再次使用“cordova plugin add ionic-plugin-keyboard --save”时,此插件微调器对话框有效,但即使我使用 window.plugins.spinnerDialog.hide(),它也不会再次隐藏;
  3. 假设如果我点击登录按钮时出现登录屏幕,则 toast 通知不起作用,但当我点击输入字段时,它会立即显示示例(“用户名/密码无效”或我写的任何相关消息)。
  4. 当我查看 xcode 编译器消息时...它显示“线程警告:['Toast'] 花费了 '79.340088' 毫秒。插件应该使用后台线程。

<!DOCTYPE html>
<html ng-app="myapp">
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Security-Policy" content="default-src *; img-src 'self' data:;style-src 'self' http://* 'unsafe-inline'; script-src 'self'  http://* 'unsafe-inline' 'unsafe-eval'">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>
    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/app.css" rel="stylesheet">
    <link href="lib/ion-md-input/css/ion-md-input.min.css" rel="stylesheet">
    <link href="lib/ionic-material/dist/ionic.material.min.css" rel="stylesheet" />
    <!--<link href='https://fonts.googleapis.com/css?family=RobotoDraft:400,500,700,400italic' rel='stylesheet' type='text/css'>-->
    <link href="lib/ionic-material/dist/ionic.material.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet" />
    <link href="css/sweetalert.css" rel="stylesheet" />
    <link href="css/slidingTabs.css" rel="stylesheet" />     
  
       
    <!--<link href="https://fonts.googleapis.com/css?family=Lato:400" rel="stylesheet">-->
</head>
<body>
    <ion-nav-bar class="bar-balanced">
        <ion-nav-back-button>
        </ion-nav-back-button>
    </ion-nav-bar>
    <ion-nav-view></ion-nav-view>
    <div class="spinner">
        <ion-spinner icon="android" class="spinnerSpinner"></ion-spinner>
        <div class="spinnerBackground"></div>
    </div>
rc="lib/ionic/js/ionic.bundle.js"></script>
    <script src="lib/ionic-material/dist/ionic.material.min.js"></script>
    <script src="lib/ion-md-input/js/ion-md-input.min.js"></script>
    <script src="lib/sweetalert.min.js"></script>
    <script src="scripts/slidingTabsDirective.js"></script>
    <script src="scripts/ng-cordova.min.js"></script>
    <script src="lib/ionic-toast/dist/ionic-toast.bundle.min.js"></script>
    <script type="text/javascript" src="scripts/qrcode.min.js"></script>
    <!-- Cordova references -->
    <script src="cordova.js"></script>
    <script src="scripts/platformOverrides.js"></script>
    <!-- App references -->
    <script src="scripts/index.js"></script>
    <script src="app/directives.js"></script>
    <script src="app/services.js"></script>
    <script src="app/controllers.js"></script>
    <script src="app/app.js"></script>
</body>
</html>

这是我的 index.html

<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="" defaultlocale="en-US" id="io.cordova.DealNSumConsumer" version="1.0.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps">
    <name>DealnSum</name>
    <description>A blank project that uses Apache Cordova to help you build an app that targets multiple mobile platforms: Android, iOS, Windows, and Windows Phone.</description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">Apache Cordova Team </author>
    <content src="index.html" />
    <access origin="https://dealnsum.com/" />
    <vs:features />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-navigation href="http://*/*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="4000" />
    <preference name="SplashMaintainAspectRatio" value="true|false" />
    <preference name="SplashShowOnlyFirstTime" value="true|false" />
    <platform name="android">
        <icon density="ldpi" src="res/icons/android/icon-36-ldpi.png" />
        <icon density="mdpi" src="res/icons/android/icon-48-mdpi.png" />
        <icon density="hdpi" src="res/icons/android/icon-72-hdpi.png" />
        <icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png" />
        <splash src="res/screens/android/logo-new-714.png" />
        <splash density="port-ldpi" src="res/screens/android/logo-new-714.png" />
        <splash density="port-mdpi" src="res/screens/android/logo-new-714.png" />
        <splash density="port-xhdpi" src="res/screens/android/logo-new-714.png" />
    </platform>
    <platform name="ios">
        <icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" />
        <icon height="60" src="res/icons/ios/icon-60.png" width="60" />
        <icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" />
        <icon height="76" src="res/icons/ios/icon-76.png" width="76" />
        <icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" />
        <icon height="40" src="res/icons/ios/icon-40.png" width="40" />
        <icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" />
        <icon height="57" src="res/icons/ios/icon-57.png" width="57" />
        <icon height="114" src="res/icons/ios/icon-57-2x.png" width="114" />
        <icon height="72" src="res/icons/ios/icon-72.png" width="72" />
        <icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" />
        <icon height="29" src="res/icons/ios/icon-small.png" width="29" />
        <icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" />
        <icon height="50" src="res/icons/ios/icon-50.png" width="50" />
        <icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" />
    </platform>
    <platform name="windows">
        <icon height="150" src="res/icons/windows/Square150x150Logo.scale-100.png" width="150" />
        <icon height="360" src="res/icons/windows/Square150x150Logo.scale-240.png" width="360" />
        <icon height="30" src="res/icons/windows/Square30x30Logo.scale-100.png" width="30" />
        <icon height="310" src="res/icons/windows/Square310x310Logo.scale-100.png" width="310" />
        <icon height="44" src="res/icons/windows/Square44x44Logo.scale-100.png" width="44" />
        <icon height="106" src="res/icons/windows/Square44x44Logo.scale-240.png" width="106" />
        <icon height="70" src="res/icons/windows/Square70x70Logo.scale-100.png" width="70" />
        <icon height="71" src="res/icons/windows/Square71x71Logo.scale-100.png" width="71" />
        <icon height="170" src="res/icons/windows/Square71x71Logo.scale-240.png" width="170" />
        <icon height="50" src="res/icons/windows/StoreLogo.scale-100.png" width="50" />
        <icon height="120" src="res/icons/windows/StoreLogo.scale-240.png" width="120" />
        <icon height="150" src="res/icons/windows/Wide310x150Logo.scale-100.png" width="310" />
        <icon height="360" src="res/icons/windows/Wide310x150Logo.scale-240.png" width="744" />
    </platform>
    <platform name="wp8">
        <icon height="99" src="res/icons/wp8/ApplicationIcon.png" width="99" />
        <icon height="159" src="res/icons/wp8/Background.png" width="159" />
    </platform>
    <platform name="ios">
        <splash height="480" src="res/screens/ios/screen-iphone-portrait.png" width="320" />
        <splash height="960" src="res/screens/ios/screen-iphone-portrait-2x.png" width="640" />
        <splash height="1024" src="res/screens/ios/screen-ipad-portrait.png" width="768" />
        <splash height="2048" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" />
        <splash height="768" src="res/screens/ios/screen-ipad-landscape.png" width="1024" />
        <splash height="1536" src="res/screens/ios/screen-ipad-landscape-2x.png" width="2048" />
        <splash height="1136" src="res/screens/ios/screen-iphone-568h-2x.png" width="640" />
        <splash height="1334" src="res/screens/ios/screen-iphone-portrait-667h.png" width="750" />
        <splash height="2208" src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242" />
        <splash height="1242" src="res/screens/ios/screen-iphone-landscape-736h.png" width="2208" />
    </platform>
    <platform name="windows">
        <splash height="300" src="res/screens/windows/SplashScreen.scale-100.png" width="620" />
        <splash height="1920" src="res/screens/windows/SplashScreen.scale-240.png" width="1152" />
        <splash height="1920" src="res/screens/windows/SplashScreenPhone.scale-240.png" width="1152" />
    </platform>
    <platform name="wp8">
        <splash height="1280" src="res/screens/wp8/SplashScreenImage.png" width="768" />
    </platform>
    <plugin name="cordova-plugin-android-permissions" version="0.10.0" />
    <plugin name="cordova-plugin-compat" version="1.0.0" />
    <plugin name="cordova-plugin-x-toast" version="2.5.2" />
    <preference name="Orientation" value="default" />
    <preference name="Fullscreen" value="False" />
    <plugin name="cordova-plugin-inappbrowser" version="1.5.0" />
    <plugin name="cordova-plugin-splashscreen" version="4.0.1-dev" />
    <plugin name="cordova-plugin-whitelist" version="1.3.0" />
    <plugin name="cordova-plugin-spinner" version="1.1.0" />
    <plugin name="cordova-plugin-spinner-dialog" src="https://github.com/Paldom/SpinnerDialog.git" version="1.3.1" />
    <plugin name="cordova-plugin-actionsheet" version="2.3.1" />
    <plugin name="cordova-plugin-network-information" version="1.3.0" />
    <plugin name="cordova-plugin-camera" version="2.2.0" />
    <plugin name="cordova-plugin-crop" version="0.1.0" />
    <plugin name="cordova-sqlite-storage" version="1.4.9" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
</widget>

这是我的 config.xml

提前致谢,

【问题讨论】:

    标签: ios apache cordova toast


    【解决方案1】:

    我解决了这个问题...问题出在 index.html 上。 我已在 index.html 中添加了以下行,因此由于某些应用程序标准,它无法正常工作。

     <meta http-equiv="Content-Security-Policy" content="default-src *; img-src 'self' data:;style-src 'self' http://* 'unsafe-inline'; script-src 'self'  http://* 'unsafe-inline' 'unsafe-eval'">
    

    删除 index.html 中的上述行后,现在可以正常工作了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-20
      • 1970-01-01
      • 2014-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-29
      相关资源
      最近更新 更多