Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap App build with Phonegap Build alerts with errors on iOS

We are developing an app with Phonegap 2.5.0 (since there is no newer Version in Phonegap Build) and are running into troubles.

The app is a simple test app we use to compare jQuery Mobile and Sencha Touch. Therefore we have created an index.html file witch contains links to a jquery.html and a sencha.html implementing the same app with different UI but calling the same phonegap triggers.

We have two build configurations:

  • App is built locally via Eclipse
  • App is built online via Phonegap Build

We use the same web content as on our locally build Android app. We only remove the <script> element which loads the cordova.js for 2.5.0 and packs the content together with the same config.xml we use in the locally built Android app. The locally built Android App works just fine. Problems occur only when the app is built online for iOS via Phonegap Build. The Android app built online works, as expected. Only iOS makes troubles.

What happens on iOS:

  • index.html is loaded
  • we are able to click on the link that switches to the jquery.html or sencha.html.
  • after switching the app alerts with some dialogs rotating through following messages:
    1. gap:["Device","getDeviceInfo","Device455526479"]
    2. gap:["NetworkStatus","getConnectionInfo","NetworkStatus8103758"]
    3. gap:["App","show","App8103759"]
  • then we can access the app and even are able to get the current GPS position.

Any Ideas? Thanks a lot!

Our config.xml:

<?xml version="1.0" encoding="utf-8"?>
<cordova>
    <access origin="http://127.0.0.1*"/>; <!-- allow local pages -->
    <access origin=".*"/>
    <content src="index.html" />
    <log level="DEBUG"/>
    <preference name="useBrowserHistory" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <plugins>
        <plugin name="App" value="org.apache.cordova.App"/>
        <plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
        <plugin name="Device" value="org.apache.cordova.Device"/>
        <plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
        <plugin name="Compass" value="org.apache.cordova.CompassListener"/>
        <plugin name="Media" value="org.apache.cordova.AudioHandler"/>
        <plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
        <plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
        <plugin name="File" value="org.apache.cordova.FileUtils"/>
        <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
        <plugin name="Notification" value="org.apache.cordova.Notification"/>
        <plugin name="Storage" value="org.apache.cordova.Storage"/>
        <plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
        <plugin name="Capture" value="org.apache.cordova.Capture"/>
        <plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
        <plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
        <plugin name="Echo" value="org.apache.cordova.Echo"/>
        <plugin name="Globalization" value="org.apache.cordova.Globalization"/>
        <plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser"/>
    </plugins>
</cordova>
like image 823
Sebastian Barth Avatar asked May 15 '13 12:05

Sebastian Barth


2 Answers

Are you sure you have included the Phonegap JS file which is specific to iOS?? Usually, this error occurs when you wrongly include the cordova/phonegap files (belongs to Android) for iOS development. In the downloaded phonegap 2.5.0 folder, you have different sub folders for different platforms. You have to make sure you use the right Javascript files which are given for specific platforms.

Possible scenario:

You might have included the cordova-2.5.0.js file from Android folder to make iOS build. You might have just misspelled the JS file in your www folder. (Less possibility though).

Fix:

Use the Javascript (Cordova-2.5.0.js file) file from iOS folder inside the Phonegap-2.5.0 folder for iOS build.

like image 131
GenieWanted Avatar answered Oct 18 '22 04:10

GenieWanted


Phonegap Build did only support as newest version cordova 2.5.0. Now it is possible to use the version 2.7.0,too. After switching to 2.7.0 the alert()s have disapeared. Everything works as expected now!

Problem solved!

like image 44
Sebastian Barth Avatar answered Oct 18 '22 05:10

Sebastian Barth