Search code examples
iosapachecordovatoast

apache cordova ios toast and spinner dialogue issue


I have working on apache Cordova application which is for android and ios build. while working with android i have added ionic keyboard which was not necessary. but it didn't give any issue with Android build. but when i working with ios toast and spinner dialogue is not working. One of the other project is working fine with ios and android build.

  1. when i removed ionic keyboard from config.xml it wont work at all.
  2. again when i use "cordova plugin add ionic-plugin-keyboard --save" this plugin spinner dialogue works but it wont hide again even when i used window.plugins.spinnerDialog.hide();
  3. suppose if i have login screen when i click on login button toast notification wont work but when i click to input field in immediately it shows example("Username/pwd invalid "or any relevant msg i written).
  4. when i looked into xcode compiler msgs... it says "THREAD WARNING: ['Toast'] took '79.340088' ms. Plugin should use a background thread."

<!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>

this is my 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>

this my config.xml

thanks in advance,


Solution

  • I solved this issue... the issue was with index.html. I have been added the following line in index.html so due some app standards it was not working.

     <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'">
    

    now its working fine after deleting the above line in index.html