How to set fake GPS location on IOS real device - ios

Currently I have to test app and set the different fake GPS locations on real IOS 7 devices. On Android I use 'My Fake Location'. Unfortunately, I didn't find the same app for IOS 7.
Any ideas to solve my problem?

When running in debug mode you can use the little arrow button in the debug area (Shift+Cmd+Y) in Xcode to specify a location. There are some presets or you can also add a GPX file.
You can generate GPX files here manually: http://www.bikehike.co.uk/mapview.php
(from answer: https://stackoverflow.com/a/17478860/881197)

Create a .GPX file with xcode, then specify your coordinates and when your device connected, hit the little arrow button and select your .GPX file.
You can create multiple files and add lots of coordinates to single .GPX file in order to make some kind of route.

Of course ios7 prohibits creating fake locations on real device.
For testing purpose there are two approches:
1) while device is connected to xcode, use the simulator and let it play a gpx track.
2) for real world testing, not connected to simu, one possibility is that your app, has a special modus built in, where you set it to "playback" mode. In that mode the app has to create the locations itself, using a timer of 1s, and creating a new CLLocation object.
3) A third possibility is described here:
https://blackpixel.com/writing/2013/05/simulating-locations-with-xcode.html

Working with GPX files with Xcode compatibility
I followed the link given by AlexWien and it was extremely useful: https://blackpixel.com/writing/2013/05/simulating-locations-with-xcode.html
But, I spent quite some time searching for how to generate .gpx files with waypoints (wpt tags), as Xcode only accepts wpt tags.
The following tool converts a Google Maps link (also works with Google Maps Directions) to a .gpx file.
https://mapstogpx.com/mobiledev.php
Simulating a trip duration is supported, custom durations can be specified. Just select Xcode and it gets the route as waypoints.

xCode is picky about the GPX file it accepts.
But, in xCode you can create a GPX file with the format it will accept:
And then just change the content of the file to the location you need.

you can do it on real device by run device in Debug mode
Click Debug->Simulate Location -> add .gpx file for your location during run time

I had a similar issue, but with no source code to run on Xcode.
So if you want to test an application on a real device with a fake location you should use a VPN application.
There are plenty in the App Store to choose from - free ones without the option to choose a specific country/city and free ones which assign you a random location or asks you to choose from a limited set of default options.

it seems with XCode 9.2 the way to import .gpx has changed, I tried the ways described here and did not do. The only way worked for me was to drag and drop the file .gpx to the project navigator window on the left. Then I can choose the country in the simulator item.
Hope this helps to someone.

There are one solution for fake GPS in ios simulator and real device. we can use GPX file for fake GPS and simulation.
I followed the step by step guidelines of GPX file use in Xcode with simulation.
Here is full step by step guidelines of GPX file use. And also you can download the GPX file Demo from github.

Related

Permission issue? Cannot open files - files are disabled

My iOS app (Flutter based) contains a file open dialog for several file types.
One function is to open GPX and KML map files. However, when I open the file selector I can see the files but I am not able to select them, they look disabled; when I tap on them, nothing happens.
Two things are strange:
Another function must open image files. This is done with the same open file widget and works properly.
We tested three different devices (2 different iPhones, 1 iPad). Only on my iPhone 11 Max is the problem. The other devices could open the GPX files without any problems.
So, I believe it depends on my specific device. I was looking for a specific permission which I can set somewhere in the settings but I was not able to solve the problem.
Does anybody has an idea why it is not possible to open the files?
Kind regards!

Add GPX File to Xcode 6 Project

I am following the Trax app demo from Stanford's iOS lectures and the instructor set the app up to handle GPX files via AirDrop, but the iPhone simulator doesn't support AirDrop.
Is there anyway to add files (more specifically GPX files) to an app on the iPhone simulator? I thought about emailing it to myself and using Safari on the simulator, but I have no idea where that would be stored or how to access it from the Trax app.
You can add a GPX file to a project by opening the scheme editor: Product -> Scheme -> Edit Scheme. Under Options check the Allow Location Simulation box and from the dropdown choose Add GPX File to Workspace.
In order to generate a GPX file with your custom location you can use this.
The way Hegarty does it is he runs the app on his phone (when connected and registered your phone will be the first scheme on the list). Then airdrop on the Mac will see your phone and you're app will grab it.

simulate driving a route in device -iOS

I have a location based app that provides information for a driving trip in real time. I would like to test that app in device. How can I mock an entire trip without actually driving. I see a solution exists for Android through mock location apps, is there anything similar for iPhone as well? I would appreciate any pointer. Thanks for your help.
Yeah you can create a GPX file and load it in XCode.
When you start debugging an app in xcode on the bottom where the debugging logging is there is the breakpoint |> and || and there you will see a location icon (see image, black icon all the way to the right). Click that and it will give you option to add GPX file. Generate a GPX file of the route you want and when you load it the phone / simulator will automatically go through those points

How to create GPX for IOS Simulator with Altitude and Court

How can I (or can I) create a GPX file that will run on the IOS simulator and provide course and altitude information?
I have added tags in the hope they might give altitude but no joy there.
The larger issues I am having in dealing with the simulation of locations include:
1. The GPX documentation gives no semantic information;
2. The I am unaware of any documentation on how the IOS simulator responds to GPX files;
3. Many of the links to sites from this board for creating GPX files seem to create files with tags that the IOS simulator seems to ignore.
Thanks

Get data from user test on device to mac

I'm doing some user tests of my new iOS app and store some test data in a plist. When I do that in the simulator it is easy to get that file for further analysis on my mac, but how can I easily get it from a real device? This will only be used during testing and will not be part of the final version.
Possible ways I have read about but not tried (in hope to get some directions here first):
E-mail attachment
Enable file transfer to iTunes
Jailbreak (but don't want to)
Currently what I am doing is to NSLog it and copy and paste from Xcode into Excel, but this requires that the device is tethered to my mac.
Any experience or advice on easiest way to get this done?
I sometimes use iPhone Explorer to do this, because the plist file I want is not in my Documents folder. I use it to navigate to the files associated with my app on the device. Just connect your device to your laptop, run iPhone Explorer and then use it to locate the plist file you want and drag and drop it wherever you want.
You can save data from Organizer. Just click on your device and it'll show in right pane. Files from documents folder and possibly other folders can be saved.

Resources