I have implemented the user location application for iphone using xcode but for some reason the standard blue marker is not appearing on the map. So plz if anyone has an idea why is this happening let me know. Thanks
Your problem is an issue with the simulator:
CoreLocation will properly return your current location based on your IP address.
Regardless of what CoreLocation thinks, MapKit always thinks you're in Cupertino, California, at Apple's headquarters.
Combining these two together, when you draw your map and center it on the location provided by CoreLocation, you don't see the blue dot despite the fact that you have ShowsUserLocation turned on -- that's because it's over in Cupertino.
If you run the app on an actual device, CoreLocation and MapKit will be in sync and the blue dot will appropriately appear where you expect it to.
The Sample Project CurrentAddress demonstrates the usage of MapKit to show the current location in the map.
Related
Anyone know how to show the "blue pulsating dot" for the user devices location on watchOS InterfaceMap element?
In iOS this can be done to MKMapView by calling mapView.showsUserLocation = true. InterfaceMap for watchOS doesn't seem to be supporting this and I was wondering if there is some other way to do this. Of course this could be done manually by placing an annotation on the user location every time the location is updated, but it seems a bit clunky and it would be great to have the default blue marker for the user location.
Thank you
You cannot do this on watchOS. WKInterfaceMap can only be used to show a static piece of the map at the moment. WKInterfaceMap shows a noninteractive map for a specific location. You can change the location shown on the map dynamically, but there are no built-in methods to update it automatically to show the user location in contrast to what MKMapView can achieve.
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'm able to show current location on mapview. It shows round blue color circle. When I click on the circle, it shows "Current Location".
I want to show users current location as green pin. on click of pin, i want to show "My Location" annotation. How to do it.
Please suggest me how to do it.
Doing so is a bad idea. The blue dot and associated animation is a convention that is adhered to by all MapKit apps. Your user might be moving too. A pin is associated with a fixed location. Someone holding a phone is not a fixed point.
Please really think about the MapKit standards and Apple HIG they are there to help your users understand and enjoy your app.
How to Get Route from user current Location to Destination location in MkMapView?
You need to handle that yourself. Get the gps data somewhere for the route and draw the lines yourself.
I don't think that's something allowed in Mapkit. I believe it's part of the restrictions to prevent Mapkit from being used for a turn by turn application.
You can use MapKit for showing maps, but when it comes to routing you'll have to launch out to the Maps app. In the URL launching Maps you can pass the destination's lat/long coordinates and have it place pin. The user can then find their way there from their current location.
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