Closed gorgonaut04 closed 11 months ago
Just to confirm, everything was working fine in iOS 8 & 9. The only thing that changed was that users updated their phones to iOS 10 and stopped getting GPS position updates.
Regrettably I confirm the problem, my friend have just updated to iOS 10 and GPS stopped working. Can't verify since I don't have real devices, but Simulators don't seem to use mock locations too. @gorgonaut04 do you mind sharing code for your workaround while issue is not solved?
I've only parsed out lat/lon and accuracy, so if you need speed, bearing, or altitude, you'll need to parse them out as well. Make sure you get the latest kivy ios, or else the lack of prints/logging on iOS 10 without that fix will make things very difficult!
'''
iOS GPS
-----------
'''
@protocol('CLLocationManagerDelegate')
def locationManager_didUpdateLocations_(self, manager, locations):
location = manager.location
description = location.description.UTF8String()
lat, lon = [float(coord) for coord in description.split('<')[-1].split('>')[0].split(',')]
acc = float(description.split(' +/- ')[-1].split('m ')[0])
self.on_location(lat=lat, lon=lon, accuracy=acc)
Thank you, @gorgonaut04 We have a live app in AppStore and it was very bad news for us if GPS breaks on iOS 10 update. Have to patch it asap, and i don't really have experience with Pyobjus yet. But I'll try to figure out something after.
Same here! We faced this a month or so ago and I literally pulled an all-nighter trying to fight through the combined lack lack of prints/logs and this problem. Eventually cobbled together my own print statement using NSLog, via pyobjus On Fri, Nov 11, 2016 at 6:15 PM Valentine Davydov notifications@github.com wrote:
Thank you, @gorgonaut04 https://github.com/gorgonaut04 We have a live app in AppStore and it was very bad news for us if GPS breaks on iOS 10 update. Have to patch it asap, and i don't really have experience with Pyobjus yet. But I'll try to figure out something after.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kivy/plyer/issues/240#issuecomment-260095228, or mute the thread https://github.com/notifications/unsubscribe-auth/AKTLx1i6lkaiur1dcGbH7dvFIcFmVCPOks5q9SFMgaJpZM4KuNl_ .
Thanks, you workaround seems to work pretty fine, simulators for both 9.3 and 10.0 handle mock location OK too. I'll try to if not get to the core of original problem myself, then pointing community attention to it.
+1 for this issue!
+1
Heyo! It seems like this error is occuring deeper in pyobjus but I expanded on the string parsing hack above to add accuracy speed course and altitude. We should push something out soon. GPS is critical for many apps and we don't want the project kivy to suffer a lapse. Let me know if i can help here :)
@protocol('CLLocationManagerDelegate')
def locationManager_didUpdateLocations_(self, manager, locations):
location = manager.location
description = location.description.UTF8String()
lat, lon = [float(coord) for coord in description.split('<')[-1].split('>')[0].split(',')]
acc = float(description.split(' +/- ')[-1].split('m ')[0])
speed=location.speed
altitude=location.altitude
course=location.course
self.on_location(
lat=lat,
lon=lon,
speed=speed,
bearing=course,
altitude=altitude,
accuracy = acc)
Stuck on the same boat right now. I'm quite new to all this and could not figure out how to make the code above work.
Any hints?
@glins97 have you patched your ios gps with @gorgonaut04 code? My App still uses it
Yeah, it works! For those that might be unsure how to proceed, all you have to do is replace plyer/platforms/ios/gps.py with the function above. Cheers.
not an ios user myself, but seems like this code should be made into a pull request to benefit more users.
thanks.
is this fixed?
@glins97 Where exactly is the gps.py file? I have found 3 gps.py files, and none of them seem to work when I insert the code above - it appears that the files I found aren't executing at all (i put some print statements in). The three files I found were
/foo/bar/kivy-ios/build/plyer/x86_64/plyer-master/build/lib/plyer/platforms/ios/gps.py
/foo/bar/kivy-ios/build/plyer/x86_64/plyer-master/iosbuild/lib/python2.7/site-packages/plyer/platforms/ios/gps.py
foo/bar/kivy-ios/build/plyer/x86_64/plyer-master/plyer/platforms/ios/gps.py
I tried to update my project with ./toolchain.py update project-name
as well
You have to make sure you delete any "gps.pyo" files in order to force the .py file to be re-compiled. That should help you narrow down the critical file (I apologize, it's been a couple years, so I don't remember which file is the critical one to edit.)
On Sat, Apr 13, 2019 at 8:55 PM ESandberg notifications@github.com wrote:
@glins97 https://github.com/glins97 Where exactly is the gps.py file? I have found 3 gps.py files, and none of them seem to work when I insert the code above - it appears that the files I found aren't executing at all (i put some print statements in). The three files I found were
/foo/bar/kivy-ios/build/plyer/x86_64/plyer-master/build/lib/plyer/platforms/ios/gps.py
/foo/bar/kivy-ios/build/plyer/x86_64/plyer-master/iosbuild/lib/python2.7/site-packages/plyer/platforms/ios/gps.py
foo/bar/kivy-ios/build/plyer/x86_64/plyer-master/plyer/platforms/ios/gps.py
I tried to update my project with ./toolchain.py update project-name as well
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kivy/plyer/issues/240#issuecomment-482917693, or mute the thread https://github.com/notifications/unsubscribe-auth/AKTLx0JbdLGVOroDkExDpfO-DHKtG05_ks5vgqa_gaJpZM4KuNl_ .
On iOS 10 devices and simulators, the lat/lon are not available when the delegate function / callback locationManagerdidUpdateLocation() is called. The data structure is inexplicably incorrect. "manager.location" is of type CLLocation (correct), but when trying to access manager.location.coordinate, of type CLLocationCoordinate2D on iOS 8/9, I get the error "not enough parameters for coordinate" on iOS 10. What?? Should this be a plyer or pyobjus issue? I can't understand how this could be happening just in kivy!
My current workaround is to get the debugprint member from manager.location, and parse that string for the lat/lon and accuracy. It works, but the docs claim this is deprecated...