Discussion Forums  >  Maps, Device Location, Tracking

Replies: 9    Views: 361

PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
03/04/14 10:09 PM (10 years ago)

Can the iOS simulator 'pretend' to be elsewhere?

Hi all, I want to test a geo-search function of my store locator app, but that function starts with the user's current location. At the moment the simulator puts me somewhere between Tonga and the Galapagos, which is very wet and does not have many stores nearby :) Is there a way to get the simulator to pretend it's somewhere else? Thanks, Paddy.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/04/14 10:13 PM (10 years ago)
Hi Paddy, Found this on Stackoverflow.com : As of iOS 5, the simulator has a configurable location. Under the Debug menu, the last entry is "Location"; this gives you a sub menu with: None Custom Location Apple Stores Apple City Bicycle Ride City Run Freeway Drive Custom Location lets you enter a Lat/Long value. Bicycle ride, City Run, and Freeway Drive are simulation of a moving location (in Cupertino, of course). Hope it works! Mark
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/04/14 10:14 PM (10 years ago)
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
03/04/14 10:19 PM (10 years ago)
Thanks heaps Mark, that's exactly what I was looking for. Who'dathunk it would have been there in the menu, just looking at me? (Slightly embarrassed!) Btw, I want to thank you for your awesome tutorial on sending location via a form. I've used bits of it and it was a real help. Cheers Paddy.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/04/14 10:21 PM (10 years ago)
Rock on! There are so many things I've missed in Xcode that have been "right there!" It's crazy. Very happy that the tutorial has helped you out a bit! Mark
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/04/14 10:49 PM (10 years ago)
Don't feel bad… It took me a while to find that out too. I also use 'gpx' files to emulate different device locations… Add a 'new file' and when the dialog appears, choose 'iOS Resources' and then 'GPX'. You create one GPX per location, and then you can choose locations along with the Apple default locations (Tokyo, Moscow, London, etc…) located at the top of the debug area on that toolbar... Cheers! -- Smug
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
03/04/14 10:57 PM (10 years ago)
Thanks guys.. it's kind of working - I have my location set correctly and it's showing fine but the simulator (or more likely, my code) is messing with the locations. eg it tells me that Seattle is less than 100 miles from Austin, TX (where I've set my home location) and is simultaneously in West Ghana. (Could be a few surprised Seattleites when they wake up there...) hmmm.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/04/14 11:08 PM (10 years ago)
West Ghana, I know it well. I'll put it this way… 'when the code doesn't recieve enough location information' (for whatever reason) it tends to land me at 0,0 in the middle of the ocean, just south of Accra. The *only* reason I use the location manager in the Smug MsgLoc is because of the compass. Otherwise, for "most" purposes, you can get by with 'appDelegate.rootDevice.deviceLatitude' or Longitude, even while 'spoofing' the location. Don't know if any of that helps; mostly opinion I suppose. Cheers! -- Smug
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
03/04/14 11:11 PM (10 years ago)
Aah, that's why I was getting soggy before. I've spent lots of time at 0,0! Will post my latest challenge in a separate post. Cheers Paddy.
 
PaddyO
Lost but trying
Profile
Posts: 189
Reg: Sep 11, 2013
Geelong
5,190
like
03/05/14 04:06 PM (10 years ago)
Quick follow-up to the simulator question: can anyone explain the relationship between the location setting in the iOS simulator (Debug>Location)and the similar setting in Xcode itself (Debug>Simulate Location)? If a location is set in Xcode does the simulator inherit it, or do the settings conflict with each other somehow? No matter which combo I'm using I'm still not able to report [deviceLatitude] or [deviceLongitude], even though my 'pretend' location does show up on maps (the pulsing blue dot) if either one is set. Cheers Paddy
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.