My app uses navigator.geolocation provided by PhoneGap. When running the app on iPhone is asks for location permissions twi开发者_Go百科ce, i guess one for the app and one for safari, how do i solve this?
I was having the same problem, but this fixed it: Location permission alert on iPhone with PhoneGap
you have to rely on OnDeviceReady(), and it'll only call once.
Call the geolocation initialisation in onDeviceReady
Method and load this in body tag
function onDeviceReady(){
return navigator.geolocation.getCurrentPosition(initialize);
}
Unfortunately, you can't disable the second alert, because it is coming from WebKit and not iOS. However, I suggest you write a bug on the WebKit Bugzilla and ask them to disable the second alert when PhoneGap is being used in an app if you believe two confirmation messages will be confusing to the user.
Ad@m
I think i found the solution, at least did it work for me: some files of the geolocation plugin were missing! You can find my solution here.
精彩评论