Jenz
Jenz

Reputation: 8369

Phonegap build app not working for iOS

I'm building mobile app using phonegap build. I have build app for iOS, Android and windows and I'm testing it in TestObject. What I'm doing in my app is redirecting to http://google.com on page load itself.

index.html

<!DOCTYPE html>

<html>
    <head>
        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>  
        <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" charset="utf-8">
            function onLoad() {
                  document.addEventListener("deviceready", onDeviceReady, true);
            }

            function onDeviceReady() {
                window.location.href = "http://google.com";
            }
        </script>
    </head>
    <body onload="onLoad();">
  </body>
</html>

config.xml

<?xml version="1.0" encoding="UTF-8" ?>
    <widget xmlns   = "http://www.w3.org/ns/widgets"
        xmlns:gap   = "http://phonegap.com/ns/1.0"
        id          = "com.newApp.mobileApp"
        versionCode = "1" 
        version     = "1.0.0" >

    <!-- versionCode is Android only -->
    <!-- version is in major.minor.patch format --> 
    <name>My New App</name>

    <description>
        An example for phonegap build app which wont show up in the playstore. 
    </description>

    <author href="https://YourWebsite.com" email="[email protected]">
        Name Of The Author
    </author>

    <plugin name="cordova-plugin-whitelist" source="npm"/>
</widget>

While testing with android (apk file), it is redirecting to google.com. But when I test with iOS device (ipa file), it is showing blank page only.

Why it is not working for iOS?

Can anyone help me to fix this? Thanks in advance.

Upvotes: 0

Views: 1132

Answers (1)

shahbaz
shahbaz

Reputation: 1

<access origin="*" launch-external="yes" />
  <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />
  <access origin="http://127.0.0.1*"/>
  <allow-navigation href="*"/>
  <allow-intent href="*"/>

to be on safe side regarding whitelist , i use these intents in my app

in addition to above , i added this plugins for Android

<gap:plugin name="cordova-plugin-whitelist" version="1.1.0" source="npm" />

and for IOS

<plugin name="cordova-plugin-whitelist" spec="https://github.com/apache/cordova-plugin-whitelist.git" />

Upvotes: 0

Related Questions