I have integrated the myAnnotationview custiomed api in to my project.And i have added some address on it.I want to test it from iphone simulator.Is it possible?How can i achieve it?Do i need to ON anything in Simulator?
Thanks
I'm not sure what the problem is or what you hope to achieve. You can add a custom annotation to a specific location specifying the coordinate using CLLocationCoordinate2DMake( , );
If you are interested in your current address, use CLLocationManager for the specific location. On the simulator on a MKMapView your current location is always Infinite Loop at San Jose, California.
Related
Is there any way in iOS to spoof the GPS location. I mean to say show user different coordinates not the real one ?
Thanks!
As far as i know gps gives you lat long and you show it on map.
What you can do is add your code in between to spoof obviously iam not talking about the default app. Look at heversine formula it will be helpfull
take care of water bodies and buildings you dont want to spoof the position of car in ocean iguess
the most easiest way to do that is make the map annotation you own,
you may look that this https://github.com/samvermette/SVPulsingAnnotationView
hide the original one & make a fake annotation view with any location you want
i have an iPhone project in xcode, i've put a mapview and with the next code i show the user's location:mapView.showsUserLocation=YES;.
But i want that when the user opens the app the applications zooms with an animation automatically, i think that i need to put this code in the viewDidLoad method.
Finally i need to store the latitude into a variable, i tried to to that with the next code: float latitud = mapView.userLocation.coordinate.latitude; but the latituded that this returned was not the correct one of my location, i think that i need to do this with the CLLocationManager but i don't know how to do that.
Please, help me.
Thanks a lot.
If you are checking this with simulator you won't get your location coordinate. Your xcode give apple head-quarters as the user location
mapView.showsUserLocation=YES;
will work only in device.
I am developing an GPS based app. So I was wondering how could I simulate location on iphone simulator?
I downloaded an sample app locateMe. This app does not work on simulator. Does simulator not support location api?
Any help would be appreciated.
Update:
Xcode 4.2 with iOS 5 supports GPS positioning.
Select the Simulator -> Debug -> Location -> Custom Location...
Previous Version
No the simulator does not support it. So for GPS you have to install the application in the device to check it.
Simulator is gonna give you longitude and latitude as the address of Cupertino Where the headquaters of apple is.
So you have to use device only.
Happy Coding
According to the documentation, when using the simulator:
"The relocation reported by the
CoreLocation framework in the
simulator is fixed at the following
coordinates (accuracy 100 meters),
which correspond to 1 Infinite Loop,
Cupertino, CA 95014.
Latitude: 37.3317 North Longitude:
122.0307 West"
So, in practical terms, you should be able to build the app but you'll be unlikely to do anything useful with it.
You might wanna check out my FTLocationSimulator at http://github.com/futuretap/FTLocationSimulator
It reads a KML file generated by Google Earth to provide faked location updates. It also updates the blue userLocation dot in a MKMapView with the simulated location updates.
In Xcode 4.2 we can simulate . There is a location symbol on the debug area (while you run the app). There are some predefined locations . Also we can add new GPX files
The solution was to subclass CLLocationManager and define a new delegate #protocol, called DLocationManagerDelegate.
It is designed to be a simple drop-in replacement for CLLocationManagerDelegate that compiles down to a very thin layer when deployed on an actual device.
When running on the device it will return data as normal using CoreLocation, but in the simulator it will read latitude and longitude from a text file (defined in the DLocationManager.h file).
I hope this helps, the implementation is on the simple side and you have to startUpdatingLocation and stopUpdatingLocation to update the display.
http://code.google.com/p/dlocation/
I want to allow users to set the GPS information on the iPhone Simulator via GUI.
But I'm not sure how to archieve this - it seems that this tool called iSimulate does this somehow by installing an own SDK. But I can't figure out how they "override" / "hack" the simulator by that.
Thanks!
Added a second answer since there are now integrated features in Xcode (≥4.2). There are two ways to simulate location updates:
In the iOS Simulator, under "Debug/Location" you're able to specify a constant latitude/longitude or select several predefined profiles like "City Run" or "Freeway Drive".
In Xcode there's a new location icon in the debugger, right next to the Step Out button. It lets you select several hardcoded cities worldwide and add a custom GPX file to your project. The nice thing about location simulation in Xcode is that it also works on the device (just don't forget to turn it off again otherwise your auto timezone will be wrong!). The custom GPX file is nice, too, although it sometimes crashes Xcode if the GPX file is not recognized. Make sure you use <wpt> tags only:
<?xml version="1.0"?>
<gpx version="1.1" creator="Xcode">
<wpt lat="47.52789018096815" lon="7.385249894876031"></wpt>
<wpt lat="47.52720984945248" lon="7.382647784661411"></wpt>
...
</gpx>
As far as I know, iSimulate is not employing any hacks. It is code that runs within your app on the Simulator which communicates with a device over the network. When it receives messages from the device (touches, GPS, acceleration) it simulates those events by calling your app's code as though the system had triggered them.
For example, to receive GPS location updates you must create an instance of CLLocationManager and then configure one of your classes to be its delegate. Well, on the iPhone Simulator you can instead start code that sends fake messages to your delegate instead. If you just call a delegate's method like this:
[delegate locationManager:nil didUpdateToLocation:newLocation fromLocation:oldLocation];
Your code won't have to know that the location update is fake. If you want to get fancy, you could create a new class that implements all the public methods of CLLocationManager but which sends fake messages instead. (Since Objective-C is dynamically typed, it won't need to be a subclass, as long as it responds to all the messages you send.)
As a side note, you can use these compiler macros to keep code simulator-only:
#if TARGET_IPHONE_SIMULATOR
locationManager = (id)[[MyFakeLocationManager alloc] init];
#else
locationManager = [[CLLocationManager alloc] init];
#endif
The iOS Simulator has full location simulation built in. From the "Debug" menu, you can explore your various location options.
Original answer posted while under NDA.
Check out the bottom right entry on this page. I'm under the NDA so I can't say anything except that it has saved me significant gas money. :)
1: http://developer.apple.com/technologies/ios5/
You might wanna check out my FTLocationSimulator at http://github.com/futuretap/FTLocationSimulator
It reads a KML file generated by Google Earth to provide continuous location updates. It also updates the blue userLocation dot in a MKMapView with the simulated location updates.
In Xcode 4.2 we can simulate . There is a location symbol on the debug area (while you run the app). There are some predefined locations . Also we can add new GPX files
Hy stephanos,
The information of the GPS cannot be changed. It is protected and I don't believe that iSimulate can change it.
As far as I know, iSimulate is a tool to send commands from a device to the iPhone simulator, like accelerometer, touches, orientation, etc, including the current GPS location.
The SDK of iSimulate works with the app. You have to install the app in the device and add the sdk to your project, so you don't need to buld and run your app to the device all the time that you would be doing normally.
Cheers,
VFN
Check out https://github.com/100grams/CoreLocationUtils
Just to extend #Ortwin Gentz answer:
If you need further config of every gps point in your gpx file. Take a look at this page:
http://www.topografix.com/gpx_manual.asp
It tells you exactly how you can provide further details like speed and height of a specific point.
I need put information about place, where is iPhone now, to UILable in my screen. [Country][City][Street] and maybe coordinates [lat][lng]. For example in my UILable should be:
Your location is German, Berlin, Tiergarten
Can someone show me really simple code how can i get such information that put in my UILable?
The MapKit framework (part of iPhone OS 3.0) provides this for you. Specifically the MKPlacemark object, which you can obtain for a set of co-ordinates using an MKReverseGeocoder.
You need access to a reverse geocoding service, which will take your lat/lon coordinates as input and return some kind of structured address of that location.
Google's is available here: http://code.google.com/apis/maps/documentation/geocoding/index.html#ReverseGeocoding