GetCurrentPosition almost always does not work in PhoneGap 1.3 on iOS 6

I have an existing PhoneGap 1.3 application that does some geolocation that works fine in iOS 4 and 5. In iOS 6, getCurrentPosition almost always triggers a failure callback. After a failure, additional getCurrentPosition calls do not work either on success callbacks or in the event of a failure. I reduced the application to the following code, which demonstrates the same behavior as my full application.

document.addEventListener("deviceready", function() { console.log('deviceready!!!'); successCallback = function() { console.log('success!!!'); }; failureCallback = function() { console.log('failure!!!'); navigator.geolocation.getCurrentPosition(function() { console.log('success 2'); }, function() { console.log('failure 2'); }); }; navigator.geolocation.getCurrentPosition(successCallback, failureCallback); }, false); 

When it fails, this is what I get in the log:

 2012-09-24 16:26:46.576 MyAppName[7250:16703] [INFO] deviceready!!! 2012-09-24 16:26:56.582 MyAppName[7250:16703] [INFO] failure!!! 

Nothing more.

Any ideas on where to go with this?

+4
source share
1 answer

Answer: set EnableLocation in PhoneGap.plist to NO. Apparently, if it is configured for YES, there are memory issues for PhoneGap apps running on iOS 6. The fix was implemented, but right now I don’t think about it in the official version of PhoneGap. FWIW, I can’t find those who really know what EnableLocation is doing.

0
source

Source: https://habr.com/ru/post/1436042/


All Articles