UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

HOW can I change my location in an iOS app for testing, need a button for testers to change their location in app.

Forums > iOS

I have been looking into core location and cclocationmanager, is there a way to add a button in my app so that our testers change their location? They need to fake their location to start orders and jobs? is there a way to create a CLLocationCoordinate2D(lat, long) and pass it to the core location so the device will think its there? In the simulator, YOU HAVE TO or your at apple, i can change location with features>location>custom location and enter lat and long. This is great but i need my testers to be able to do something similar through the app. If anyone can point to a solution would be grateful.

Thanks for any help or info on how to do this, newish iOS dev


You could mess around in the delegate methods with the coordinates but my guess is everytime the location updates your coordinates are overwritten. I don't think this is worth the hassle just for testing.

Is it possible you provide some example locations for testing your testers can choose from? Or do you have to map a route?


ya there is an initial geofence, then tracks route, but i can get by if i can just have them switch to fake location for start of job, then switch location and finish job.


Then for the sake of testing create example locations and skip location tracking completely and create a pool of locations. So when they start a random location from the pool is chosen and also when they finish.


Hacking with Swift is sponsored by Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.