vermont42 / GpxLocationManager

GpxLocationManager is a replacement for CLLocationManager that allows the developer to use GPS data from GPX files or CLLocation arrays for testing.
Other
144 stars 24 forks source link

Fatal error: Index out of range. #26

Open justbcuz opened 5 years ago

justbcuz commented 5 years ago

There is a fatal crash with index out of range at line 167 in GpxLocationManager.swift.

Look like the ">=" of the if statement on line 166 is incorrect.

screen shot 2018-11-07 at 9 53 10 am

screen shot 2018-11-07 at 9 53 41 am

nkanetka commented 5 years ago

Yikes!!! Thanks for catching this. There are a few things that I'd like to see changed here (safe grabbing of collections 🤔). We'll get a fix for this soon :)

vermont42 commented 5 years ago

@justbcuz Are you able to share your test data? Also, may I ask how you might be planning to use GpxLocationManager? Knowing that the framework is being used in real apps is excellent motivation for Nehal and me to maintain it.

I detect an Astérix mustache in your avatar photo.

justbcuz commented 5 years ago

@vermont42 Yes, there maybe some sort of Astérisk shenanigans going on there :)

Please find below a ZIP if the gpx file I am testing with. Luv-hq-30mph.gpx.zip

I am writing a persistent data POC to test realtime data synchronization and was using location updates as the trigger to update a stored object. To see the data synchronization across devices (and not leave my desk) I wanted to test locally using multiple simulators, but Simulator only attaches the Debug->Location->Freeway Drive to the active Xcode debug session. Therefor I could see the data sync going oneway.

This is when I found GpxLocationManager. I love the passthrough wrapper around CLLocationManager, it makes local Location simulation testing an easy add.

#if targetEnvironment(simulator) let _locationManager: LocationManager = LocationManager(type: .gpxFile("Luv-hq-30mph")) #else let _locationManager: LocationManager = LocationManager(type: .coreLocation) #endif

I plan on using this more and more.

nkanetka commented 5 years ago

27 Helps stop index out of bound errors from occurring in the future :)