ios - PhoneGap/Cordova: Fine in Simulator, suddenly not working on device: Can't find jQuery -


this began happening: boss took phone development copy of app on short business trip, , reported error couple days trip. assumed had made changes json returning server , broke it, have back, doesn't seem related work on server @ all.

here error message in console:

error in success callback: geolocation3 = referenceerror: can't find variable: jquery 

or

error in success callback: geolocation3 = referenceerror: can't find variable: $ 

so clearly, can't find jquery. executes 'deviceready' fine. works fine in simulator. using jquery cdn both jqm , jq , can access both via browser.

so gives? why not able find jquery - , on device?

i see lot of similar questions on web, none of them have clear answer. "clean , rebuild" others simple typos.... nothing this. it's not location permissions issue. it's not connection issue. it's not url whitelist issue.

your appreciated always. thanks!


i'll give code can below:

<head>     <meta charset="utf-8">     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">     <title>xxxxxx</title>      <link rel="stylesheet" href="css/jquery.mobile.css" />     <link rel="stylesheet" href="css/themes/app-2012-11-30.css" />     <link rel="stylesheet" type="text/css" href="spec/lib/photoswipe/photoswipe.css" />     <link rel="stylesheet" type="text/css" href="css/index.css" />     <!-- cordova -->     <script src="cordova-2.1.0.js" type="text/javascript"></script>     <!-- jquery -->     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>     <!-- google -->     <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>     <!-- add ons -->     <script src="spec/lib/photoswipe/lib/klass.min.js"></script>     <script src="spec/lib/photoswipe/code.photoswipe.jquery-3.0.5.js"></script>     <!-- objects -->     <script src="js/map.js" type="text/javascript"></script>     <script src="js/prefs.js" type="text/javascript"></script>     <script src="js/search.js" type="text/javascript"></script>     <script src="js/storage.js" type="text/javascript"></script>      <script src="js/helpers.js" type="text/javascript"></script>     <script src="js/player.js" type="text/javascript"></script>      <script src="js/record.js" type="text/javascript"></script>       <script src="js/connection.js" type="text/javascript"></script>      <script src="js/location.js" type="text/javascript"></script>       <script src="js/header-footer.js" type="text/javascript"></script>     <script src="js/featured.js" type="text/javascript"></script>     <script src="js/list.js" type="text/javascript"></script>     <script src="js/index.js" type="text/javascript"></script>     <script type="text/javascript">         document.addeventlistener("deviceready", ondeviceready, false);         function ondeviceready(){             console.log('device ready');             storagesetup();             checkconnection();             getlocation();             showfeatured();             getsetup();             clupdate();             $(document).bind( 'mobileinit', function(){                 $.mobile.defaultpagetransition = "none";                 $.mobile.loader.prototype.options.textvisible=false;                 $.mobile.loader.prototype.options.html = '<div class="loading"></div>';                 $.mobile.pushstateenabled = false;             });             $(document).bind('pagebeforeshow',function(){                 setheaderfooterinfo();             });                  }     </script> 

getlocation in .js file. see function getstreetaddress there, contains ajax call ($.ajax or jquery.ajax) , gives error.

function getlocation() {     glattempt++;     navigator.geolocation.getcurrentposition(onlocationsuccess, onlocationerror); }   // onsuccess geolocation function onlocationsuccess(position) {     var lat = position.coords.latitude;     var lng = position.coords.longitude;     storage.location.lat = parsefloat(lat.tofixed(6));     storage.location.lng = parsefloat(lng.tofixed(6));     storage.location.coords = lat.tofixed(6) + ',' + lng.tofixed(6);     if(ajax_rg == null){         getstreetaddress(storage.location.coords);     } } 

2 possible scenarios can think of:

  1. ios devices case sensitive file/folder names. make sure use same case added files , folders. remember ios simulator case insensitive. case insensitive file reference work on simulator not work in device.

  2. remove jquery reference cdn , add locally. when packaging app , deploying it, doesn't make sense use cdn. happen ondeviceready event fired jquery files not downloaded cdn...


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -