How location simulation works under the hood in Xcode? - ios

I've been experimenting with location simulation in Xcode. Turns out, when you build a debug app with the simulation turned on, it somehow hijacks Core Location feed for every app and you won't be able to get your real location until you build the debug app with this feature turned off.
How exactly does it work under the hood? Could it be LLDB injecting some code to Core Location library?
Is there a way to do the same without Xcode?

Related

Simulate GPS location on iPhone without Xcode

For a little project I´m trying to simulate locations on my iPhone/iPad with the existing Maps - App. With XCode on Mac, you can simulate locations with the help of a GPX-file. But is this also possible without Xcode? Can the GPX-file be saved on the iPhone and then started from there? A second option would be to create a new map using MapKit. But I actually want to use the internal Maps app.
Many Thanks!
No, unfortunatelly this is not possible. There is no way how you can save GPX-file at real device without Xcode simulator at this point.

How to test ARKit app? Can ARKit app be tested using recorded video instead of live video?

Getting started with ARKit development. Imagine that testing an app in development between builds requires imaging an environment to expose the app to a scene and that having to physically hold and/or move camera to capture live scene will be extremely cumbersome each time.
Can an app be tested with recorded video in order to avoid having to capture a realtime scene each time an app has to be tested? If so, how to do so?
Unfortunately, there is no other way to test ARKit apps except running them on your device. I agree, it is a cumbersome process, but for now thats all we have. Hopefully, in the future, Apple will make some sort of AR simulator so that we can test our apps in a faster and easier way.
Yes you can record videos using Reality Composer, then airdrop them to your mac, add them to your Xcode project, edit the scheme to enable ARKit "Replay data" (it may only appear when a device is connected), then select your video in the drop-down list
Edit : screenshot made using Xcode 12.5.1

How to simulate locations in real device with xcode 8?

I'd like to know whether it's possible to simulate locations in my app when testing it on a real iPhone connected to xcode(instead of the simulator) ?
It seems that it was possible via the Instruments->Automator in other versions of Xcode but this service has been removed from Xcode 8. Most probably location simulation in a real device is possible via user interface testing, but I've never done it.
I want to programatically simulate multiple locations with a delay so I'm pretty sure just a GPX file won't be enough.

Location Simulation Without Running Xcode

Is there any way to simulate a location on an iOS device without having to run Xcode with gpx files to do so? I'm fluent in swift and objc and would like to make an app simulate a location without running Xcode. The down side is that when you want to simulate a location without being connected to Xcode the app does not continue to simulate the location. Any help would be greatly appreciated!
Sometimes I use a quite ugly hack to do that.
When you have your device connected to the Xcode while simulating location, just remove the lighting cable without killing an app directly.
The app will crash but when you relaunch it you will see it shows the same simualated location despite the fact it's no longer connected to the Xcode.
Note that this is not an elegant approach and to make your device location services work properly again, you have to run an app from Xcode on your device and explicitly set Debug/Simulate Location/Don't Simulate Location

How to emulate location while app isn't running

I'm building an iOS 8 app that features GeoFencing. I need to test this and I know that I can emulate the location in Xcode using the preconfigured locations or providing a GPX file. However, as this app needs to act based on region monitoring when it's killed (swiped up in multitasking by user), how can I test it without getting in my car and driving around?
Thanks!

Resources