Jump to content
uniGUI Discussion Forums
andyhill

iPhone GeoLocation Test Code - Please Help

Recommended Posts

Please advise how to make this js code work - thanks in advance.

 

 

procedure TMainmForm.UnimButton1Click(Sender: TObject);
begin
  UniSession.AddJS(
 
    'navigator.geolocation.getCurrentPosition(success, fail) '+
 
    'success(position)'+
    '{ '+
    '  alert("Your latitude: " + position.coords.latitude + "longitude: " + position.coords.longitude); '+
    '} '+
 
    'fail(error)'+
    '{ '+
    '  switch(error.code) '+
    '    { '+
    '      case 0: '+ // UnKown
    '        alert(error.message); '+
    '        break; '+
    '      case 1: '+ // Denied
    '        alert(error.message); '+
    '        break; '+
    '      case 2: '+ // UnAvailable
    '        alert(error.message); '+
    '        break; '+
    '      case 3: '+ // TimeOut
    '        alert(error.message); '+
    '        break; '+
    '    } '+
    '} '
 
  );
 
end;
  • Upvote 1

Share this post


Link to post
Share on other sites

Moving forward, I get the following error from an iPhone X even though: Location Services -> Safari Websites is set to "While Using the App"

 

"Origin does not have permission to use Geolocation service"

 

Can someone please advise how to resolve - thanks.

Share this post


Link to post
Share on other sites

×