navigator.geolocation.getCurrentPosition sometimes works sometimes doesn't

前端 未结 25 1898
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 13:33

So I have a pretty simple bit of JS using the navigator.geolocation.getCurrentPosition jammy.

$(document).ready(function(){
  $(\"#business-locate, #people-l         


        
25条回答
  •  迷失自我
    2020-11-22 14:28

    For anyone working on an iPhone app...

    If your code is running in a UIWebView on iOS 9+, then you must set NSLocationWhenInUseUsageDescription within your app's plist.

    If you don't set it then getCurrentPosition will never call back and the user will never be prompted.

提交回复
热议问题