4

Since iOS 10 came out and I updated my iPhone 6 navigator.geolocation.getCurrentPosition() is not working.
Address and port: 192.168.0.16:8100

Since geolocation API is considered as unsecured origin it would work only with SSL but can I do it in a Hybrid application where I don't know what will be the address on each phone?

I've already tried what's mentioned here: Geolocation is blocked in iOS10

  • Editing in XCode was not helping
  • Editing the Info.plist in text editor was not helping

I have Cordova White List plugin istalled and I'm using this not recommended wildcard in my config.xml: <allow-navigation href="*"/> .

It works fine on android and was working fine on iPhone 6 before the iOS update.

Community
  • 1
  • 1
MagicDragon
  • 199
  • 1
  • 3
  • 18

1 Answers1

4

The problem is you are using live reload, when you use live reload the app code is served from a local web server on your computer using http:// protocol.

If you don't use live reload the code will be loaded from inside your app using file:// protocol and geolocation will work.

Consider sending a bug report to ionic so they maybe can change the local server to serve the code through https

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
  • Thanks a lot @jcesarmobile! I'll check it in like 5 hours and if omitting live reload resolves my problem I'll accept your answers. Have a good day! – MagicDragon Sep 29 '16 at 12:01
  • Omitting the live realad helped to avoid the error on the console log but the navigator still not going through. Well your answer was correct on the original question so I accept it but my code still not working on iOS 10 but it did work on the version before. Thanks – MagicDragon Sep 29 '16 at 17:22
  • Did you install the geolocation plugin? – jcesarmobile Sep 29 '16 at 17:23
  • 1
    Well months ago I just copied the plugins js file. Now I added the plugin properly and it works well. God bless you man! Thanks – MagicDragon Sep 29 '16 at 18:11