phonegap / build

This is the public repository for PhoneGap Build source and bug tracking
92 stars 33 forks source link

[winphone] Ajax request fails when submit app to the store #348

Closed javierClavei closed 9 years ago

javierClavei commented 10 years ago

jQuery Ajax request and javascript HttpRequest work fine when I install the xap file using the xap deployment tool, but when I submit the same xap to the store and download it later, calls don't arrive to the server. I have talked with Microsoft dev support and they have confirmed that is a Phonegap build bug. When I build the xap file with a Cordova project and I upload to the store, it works fine so it's a Phonegap build issue.

hectorgomis commented 10 years ago

+1

wildabeast commented 10 years ago

Do you have the 'debug' option enabled on PhoneGap Build? Another user reported that this can break XmlHttpRequests on Windows Phone ( #315 ). Note also that if you are using Dreamweaver, it may be setting the debug option by default.

javierClavei commented 10 years ago

No, I have the debug option disabled, I have seen issue you say and when I enable debug option It fails when I deploy the app with the xap deplyment tool. In my case (without debug) it works with the deployment tool but when I upload to the store not.

bau720123 commented 9 years ago

hi @javierClavei I am using PGB by Dreamweaver CC 2014 too (of course I disable the debug mode) but never happen this situation like yours could you tell us why Microsoft think that was a bug by PGB,any report or wrong message,as detail as you can describe

javierClavei commented 9 years ago

Have you submited your app to the windows store and ajax calls still working?

bau720123 commented 9 years ago

yes already in windows store I use jQueryMobile Framework I don't know that framework if as you said "ajax calls" or give us what "ajax calls" as you mean ?

javierClavei commented 9 years ago

I'm using jQuery (without mobile) and this is an example:

javierClavei commented 9 years ago

$.ajax({ type: "GET", data:params, url: urlWS + "login", timeout: 20000, success: function(data, textStatus){ console.log(data); localStorage.setItem("nci",data); window.location.href='#/principal';

            },
            error: function(xhr, textStatus, errorThrown){
                $ionicLoading.hide();
                if(xhr.responseText){navigator.notification.alert(xhr.responseText, null, lang[iso].app, "ok");}
             }
         });
javierClavei commented 9 years ago

When I download the app from the store the call never arrives to the server, it seems is about permissions... When I install it in my phone with the application deployment tool runs fine (with phonegap build) When I download it, developed with a cordova project , from the store runs fine. I don't know what can I do

bau720123 commented 9 years ago

this is my app http://www.windowsphone.com/en-us/store/app/phonegap-with-jquery-mobile/ab7bc038-ee4c-44f2-bbff-613a61fc9493

have you already set the whitelist in your config.xml ? < access origin="*" / >

or tell us,why microsoft think that was a bug ? Clear reason

javierClavei commented 9 years ago

Yes

javierClavei commented 9 years ago

I have found more people with the same situation: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/cbbeba17-cf7e-4ac6-85b8-cb38f348dc72/suscpected-ajax-issues-with-phonegap-app-also-cant-install-to-test?forum=wpdevelop

http://stackoverflow.com/questions/23882347/ajax-request-windows-phone-8-doesnt-work-when-putting-on-the-market

javierClavei commented 9 years ago

I have made a empty proyect with only the call and the same problem. I think I have something wrong in my config.xml. There isn't other posibility, can you help me?

<?xml version='1.0' encoding='utf-8'?> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:gap = "http://phonegap.com/ns/1.0" id = "com.pinea.metricsbiprueba" versionCode = "0" version = "1.0.0">

<name>MetricsBI prueba</name>
<description>
    Para el control de indicadores.
</description>

<author email="clavei@clavei.es" href="http://www.clavei.es">
    Clave Informática
</author>

<!-- Plataformas que queremos compilar -->
<gap:platform name="ios" />
<gap:platform name="android" />
<gap:platform name="winphone" />

<content src="index.html" />
<access origin="*" />
<!-- todas las plataformas (preferencias) -->
<preference name="fullscreen" value="false" /> <!-- true or false / Si queremos ver la app a pantalla completa -->
<preference name="phonegap-version" value="3.5.0" />
<preference name="orientation" value="portrait" />

<!-- iOS only (preferencias) -->
<preference name="target-device" value="mobile" /> <!-- mobile, tablet or universal / Define el tipo de dispositivo compatible -->
<preference name="prerendered-icon" value="true" /> <!-- false or true / Si Apple aplica el brillo al icono del escritorio -->
<preference name="ios-statusbarstyle" value="default" /> <!-- default, black-opaque or black-translucent / Estilo de la barra de estado -->
<preference name="detect-data-types" value="false" /> <!-- true or false / Controla si ciertos tipos de datos (como números de teléfono y fechas) se convierten en enlaces automáticamente -->
<preference name="exit-on-suspend" value="false" /> <!-- true or false / Si es true, la aplicación termina cuando se suspende, por ejemplo, cuando se presiona el botón home -->
<preference name="DisallowOverscroll" value="true" />
<preference name="AutoHideSplashScreen" value="false" />

<!-- Android only (preferencias) -->
<preference name="android-minSdkVersion" value="16" /> <!-- 16 = Android 4.1, 4.1.1 / Mínima versión de An droid SDK. Corresponde a los atributos uses-sdk del AndroidManifest.xml -->
<preference name="android-targetSdkVersion" value="16" /> <!-- 16 = Android 4.1, 4.1.1 / Un entero que designa el nivel de API que los objetivos de la aplicación. Corresponde a los atributos uses-sdk del AndroidManifest.xml -->
<preference name="android-installLocation" value="auto" /> <!-- internalOnly, auto or preferExternal / Decimos donde instalar la app -->
<preference name="android-windowSoftInputMode" value="adjustPan" /> <!-- http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft / Definimos como interactúa la ventana principal de la actividad con la ventana del teclado virtual en pantalla -->
<preference name="SplashScreenDelay" value="10000"/>
<gap:config-file platform="android" parent="/manifest ">
    <application android:theme="@android:style/Theme.Holo.Light.NoActionBar"></application>
</gap:config-file>

<!-- WinPhone only (preferencias) -->
<gap:config-file platform="winphone" parent="/Deployment" mode="replace">
    <Languages xmlns="">
        <Language code="es-ES"/>
    </Languages>
    <DefaultLanguage xmlns="" code="es-ES" />
</gap:config-file>

<!-- iOS only (icons) -->
<icon src="icons/ios/icon.png" gap:platform="ios" width="57" height="57" />
<icon src="icons/ios/icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="icons/ios/icon_at_2x.png" gap:platform="ios" width="114" height="114" />
<icon src="icons/ios/icon-72_at_2x.png" gap:platform="ios" width="144" height="144" /> <!-- retina iPad support: PhoneGap 2.5.0+ only -->

<!-- Android only (icons) -->
<icon src="icons/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
<icon src="icons/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
<icon src="icons/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
<icon src="icons/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />

<!-- winPhone only (icons) -->
<icon src="icons/winPhone/icono.png" gap:platform="winphone" />
<icon src="icons/winPhone/tile.png" gap:platform="winphone" gap:role="background" />

<!-- iOS only (splash) -->
<gap:splash src="splash/ios/Default.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="splash/ios/Default_at_2x.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="splash/ios/Default_iphone5.png" gap:platform="ios" width="640" height="1136" />
<gap:splash src="splash/ios/Default-Portrait.png" gap:platform="ios" width="768" height="1004" />
<gap:splash src="splash/ios/Default-Portrait_at_2x.png" gap:platform="ios" width="1536" height="2008" /> <!-- retina iPad support: PhoneGap 2.5.0+ only -->

<!-- Android only (splash)-->
<gap:splash src="splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
<gap:splash src="splash/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />

<!-- winPhone only (splash)-->
<gap:splash src="splash/winphone/splash.jpg" gap:platform="winphone" />

<!-- Plugins -->
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.statusbar" version="0.1.4" />
<gap:plugin name="com.phonegap.plugins.pushplugin" />
<gap:plugin name="org.apache.cordova.media" version="0.2.3" />
<gap:plugin name="org.apache.cordova.dialogs" version="0.2.6" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="de.appplant.cordova.plugin.local-notification" version="0.7.4" />
<gap:plugin name="nl.x-services.plugins.toast" version="2.0" />
<gap:plugin name="org.apache.cordova.globalization" version="0.2.6" />

bau720123 commented 9 years ago

is the config.xml is PGB's config.xml or Cordova's config.xml ?

javierClavei commented 9 years ago

PGB's. I'm sure issue is there

bau720123 commented 9 years ago

in my config.xml have no this line

In addition,just same as yours I don't know if the problem is try it

goya commented 9 years ago

i notice you don't allow network, try adding the following:

<feature name="http://api.phonegap.com/1.0/network"/>
javierClavei commented 9 years ago

Was that! adding this line works! The question is why is neccesary only put it in winphone? I think docs should have this... < feature name="http://api.phonegap.com/1.0/network"/ >

Lots of thanks