Closed wumingque closed 8 years ago
I was able to get this working in an app just fine and loading a gpx file, but the location still doesn't spoof. I don't see the location updating at all, even when I go to Debug > Simulate Location.
Hmm, not sure what could be wrong without more info. I haven't needed to use this lib recently. I'll spend some time looking at the code tonight and making a demo.
If your app is using the CLLocationMiddleManager
instead (and calling startUpdatingLocation
on that), it should start sending locations interpolated from the GPX file.
Can you throw a breakpoint into calculateLocation
and confirm that it's being called every 0.1 seconds? Additionally, your delegate method should then be receiving didUpdateLocations
with the new location.
Will try that this afternoon. I believe the gpx file is loaded and executed by the CLLocationMiddleManager.swift. but it is not spoofing the location.
calculateLocation()
is called! there was a mistake and now the calculateLocation()
is being kept called.
Interesting. Is the location passed in to didUpdateLocations
your current location or some location along the GPX route?
I did not do anything with the didUpdateLocations
... Thank you so much for pointing me the right direction. I am really rookie to MapKit
. I think the didUpdateLocations
is working, but the mapView
didUpdateUserLocation
is not updated...
@wumingque Oh! MapKit uses its own version of CLLocationManager
when you set showsUserLocation
to true
. So MapKit never knows about CLLocationMiddleManager
. If you'd like to use your own CLLocationManager (or middle manager!) to send updates to the MKMapView
, you have to do it the manual way by listening for updates on didUpdateLocations
and then setting the mapView's region
This StackOverflow answer has some example objc code and references a github project called artwork-extractor
that will let you use the native blue dot as an annotation image.
Let me know if that helps!
Thank you @Shrugs! I definitely will look into that. Since it is CLLocationMiddleManager
issue any more, I will close this.
Hello, I played with this earlier today, however I was not able to make it work. Do you have a demo I could look at? I am also wondering that if the website are generating the pgx file in a new format now.