WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

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.

   

Save 50% in my Black Friday sale.

SAVE 50% To celebrate WWDC22, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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

Reply to this topic…

You need to create an account or log in to reply.

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.