Geolocation is not working in iOS 8 simulator

2019-02-19 19:59发布

I have upgraded the geolocation plugin in cordova 3.5 to fix the issue in iOS 8 by following this post.

http://shazronatadobe.wordpress.com/2014/09/18/cordova-ios-and-ios-8/

After running the app in iOS8 simulator, I am getting the notification 'Allow "MyApp" to access your location while you use the app?' But it still shows the error locationManager::didFailWithError (null) after allowing the location service to use the app. I have tried to close the simulator and run it again and again. Also it seems that location service is active (Settings > Privacy > Location services > MyApp > While Using) by checking the settings in the simulator. By running the same app in iOS 7 simulator is working fine and able to detect the lat/lng.

FYI: I am using Xcode 6 to build the application.

Any help/suggestion will be helpful.

2条回答
你好瞎i
2楼-- · 2019-02-19 20:02

In iOS Simulator -> Debug -> Location, choose one that will be alright,

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-02-19 20:20

it sounds strange but it really works at least on my Xcode 6 Project. Make also sure to add the required Keys to your Projectname-info.plist file (e.g NSLocationWhenInUseUsageDescription -> as a Key)

Next check your scheme (Product -> Scheme -> Edit Scheme -> Allow Location Simulation) If you are using a gpx file you can also mark it as a default location.

Now you can start your simulator by pressing the run button (play symbol). As soon as your application started you will get notified for the permission.

The final fix now is to go to iOS Simulator -> Debug -> Location and change the location by choosing one out of the list except the custom location. Wait a little and change it back to custom location if it didnt change back by itself.

It worked for me, hope for you too regards Schreda

查看更多
登录 后发表回答