views:

735

answers:

2

I'm looking since quite a long time something like a CLLocationManager simulator that would enable me to simulate GPS positions (CLLocation instances that could be retrieved through the CLLocationManager standard delegate mechanism) along a predefined route for instance (with a KML or GPX file as input, or whatever, but KML would be nice ;).

Something like this is available on the Android emulator and I was wondering if anything like this would exist for the iPhone simulator. At least this would be great and would speed up testing on the simulator instead of having to drive for real.... :/

If nothing like this exists, what would be your approach to fake such behavior and implement the simulator in such a way that the client is not impacted? (No code change in the delegate of the CLLocationManager for instance.)

Thanks for your links, hints, approaches...

+1  A: 

You can't inject the simulator, but you can subclass CoreLocation:

http://code.google.com/p/dlocation/

which subclasses CoreLocationDelegate to return real data on a device and data from a text file when on the simulator.

More info here

http://stackoverflow.com/questions/802156/testing-corelocation-on-iphone-simulator

HTH

Andiih
I don't think you will be waiting long for SDK 4.0 either...
Andiih
I took a look at the approach in the project you refered to, but I think I found better than subclassing ;) My answer here : http://stackoverflow.com/questions/802156/testing-corelocation-on-iphone-simulator/2060315#2060315
yonel
+1  A: 

I think the best approach is to take control from the CLLocationManager by implementing your own category for it and simulate your expected behavior.

I put a description of this approach here : http://stackoverflow.com/questions/802156/testing-corelocation-on-iphone-simulator/2060315#2060315

yonel