I am developing an app that depends on 开发者_开发问答GPS data and works only in New York City. It will display "out of range" if the user is 30 miles away from Manhattan. The problem is that I am 8 hours away from New York City and can't really test the App functionality.
In Android, you can have DDMS send your device or AVD a mock location by simply pushing the lat and long coordinates. The App will then react to the location changes. I can't seem to find a way to do that in iOS.
Does anyone know how to simulate location on iOS?
Thanks
In Xcode 4.2 with the new iOS 5 SDK it is possible to simulate locations in the simulator. Launch your app in the simulator, click the Debug
menu option go to Location
and then click Custom Location…
. The simulator should then allow you to enter longitude and latitude.
FakeGPSUtility works fine for iOS7, can say nothing nothing about iOS8. Can be installed either manually or from CocoaPods.
Manual installation:
- Drag the FakeGPSUtility folder into your Xcode project;
- Define 'DEBUG' in target build configuration;
- Add MapKit and CoreLocation frameworks into your target.
The answer is a bit outdated so NOW you can easily simulate a location with Xcode like this:
Just run
your project and press the arrow
. If a location is active, it turns blue.
There are some preset locations and the last option is Add GPX File which could be any location you want. Just create one like this: New -> File -> GPX File
精彩评论