0

I am using core location and map kit to grab users current location and pin point it on a map. I added both the required keys in info.plist file(as I have iOS 8 SDK and Xcode 6) and used CLLocationManagerDelegate with the necessary code to display my latitude & longitude and also to pinpoint my location on map.

Although when I run the application I am seeing apple Cupertino as my current location. I checked settings like DEBUG>Location but that is not what I want. I don't want to simulate location using GPX file, all I want to do is see my current location on Simulator. I also used the sample project Locate me from here on which I can see the same results i.e my location is showed as Cupertino. Can any one please help?

skypirate
  • 663
  • 1
  • 7
  • 13

1 Answers1

0

I had the same issue you have so I've just implemented a simple Mac OS App to set the iOS Simulator's location to you Mac's location.

The way it works is I use a CLLocationManager to get your Mac's location and then use the following AppleScript to set this location in the simulator:

tell application "iOS Simulator"
    activate
end tell   
tell application "System Events"
    tell process "iOS Simulator
        tell menu bar 1
            tell menu bar item "Debug"
                tell menu "Debug"
                    tell menu item "Location"
                        click
                        tell menu "Location"
                            click menu item "Custom Location…"
                        end tell
                    end tell
                end tell
            end tell
        end tell
               
        tell window 1
            set value of text field 1 to latitude
            set value of text field 2 to longitude
            click button "OK"
        end tell
        
   end tell
end tell

The script above came from this SO answer but was slightly updated to work with the new iOS Simulator.

I hope it helps you, feel free to fork and collaborate.

Community
  • 1
  • 1
fpg1503
  • 7,492
  • 6
  • 29
  • 49