I need help
I have an MapView with annotations. The annotation's location can change in real time. Every 5 seconds, my app get a XML file and change the mapview list annotation coordinates.
But the problem is : annotation's coordinates really change but map view needs a user action to refresh the map (moving, zooming in, zooming out, ...). So how could I do a automatic mapView refresh ? (something like [mapView refresh] would be perfect )
I'm using image annotations instead of pins. If I try [mapView removeAnnotations:mapView.annotations] and rebuild annotations, I have red pins and no image.
I think the better way is to update the annotations coordinate. That's what i did, but the problem is still the same : it needs a map action from the user (scroll, zoom, etc ...)
I'm using the MapView to show the user's current location and place a pin at that location. Seems simple enough. The problem I'm having is when I load the view the map is shown however all the squares have a No Images message in them. However if I go back to my main menu and back in then the map is shown with the location zoomed in with a pin at the current location. Now granted I'm testing this on the simulator so when the map does load it zooms in on Apple's location in California. But I'm sure once I start testing on the iPhone itself it would zoom into the correct location.
After taking a look at the console it seems that the reverse geocoding is failing on the first view load and then completing successfully on the second view load.
I'm using the MapView to show the user's current location and place a pin at that location. Seems simple enough. The problem I'm having is when I load the view the map is shown however all the squares have a No Images message in them. However if I go back to my main menu and back in then the map is shown with the location zoomed in with a pin at the current location. Now granted I'm testing this on the simulator so when the map does load it zooms in on Apple's location in California. But I'm sure once I start testing on the iPhone itself it would zoom into the correct location.
The simulator will place you on apple's location, it's normal. If you have a blue drill with a Current location label be sure it'll works on you iPhone.
The simulator will place you on apple's location, it's normal. If you have a blue drill with a Current location label be sure it'll works on you iPhone.
Yeah I'm using a red pin, but I'm trying to resolve the problem where the map is not loading the first time the view is loaded - its failing reverse geocode. Like I mentioned before if I go back and then back into the mapView the map loads correctly without the No Images error in the background. Thats why I was thinking its either an issue on the simulator or maybe I should refresh the mapView.
Last edited by bigdave1024; 08-01-2009 at 10:09 AM.
Yeah I'm using a red pin, but I'm trying to resolve the problem where the map is not loading the first time the view is loaded - its failing reverse geocode. Like I mentioned before if I go back and then back into the mapView the map loads correctly without the No Images error in the background. Thats why I was thinking its either an issue on the simulator or maybe I should refresh the mapView.
I'm having these issues too. Adjusting your region and span settings (or just commenting them out) will let you see the default US view.
I figured this out last night. I ended up having to use CLLocation to save my latitude and longitude coordinates and passing those on to my MKMapView instance variable. So now when I load my map it zooms into the current location and drops a pin at that location and it works everytime. I'm not sure if that is Slum's problem as well, but that fixed it for me.
I figured this out last night. I ended up having to use CLLocation to save my latitude and longitude coordinates and passing those on to my MKMapView instance variable. So now when I load my map it zooms into the current location and drops a pin at that location and it works everytime. I'm not sure if that is Slum's problem as well, but that fixed it for me.
That's good. I don't know if Slum needed the reverse geocoding, but I do so I can grab the postal code from the placemark. That's my problem.
Would you mind posting your code to grab the postal code from the placemark? This is also on my list of things to do.
Well, I'd check out the MKPlacemark reference. There's a lot of info accessible. But you have to rely on using the reverse geocoder to get that info. I would tell you more, but I'm stuck at the moment trying to get the geocoder to even work..
Well, I'd check out the MKPlacemark reference. There's a lot of info accessible. But you have to rely on using the reverse geocoder to get that info. I would tell you more, but I'm stuck at the moment trying to get the geocoder to even work..
Did you see the code I had posted above? That is how I have my reverse geocoding working now.
Did you see the code I had posted above? That is how I have my reverse geocoding working now.
You haven't posted your code where you implement CLLocation. Would you please, if you don't mind? If I get my geocoding to work, I would gladly share with you how I get the placemark info (I have no clue if it works right now.)
You haven't posted your code where you implement CLLocation. Would you please, if you don't mind? If I get my geocoding to work, I would gladly share with you how I get the placemark info (I have no clue if it works right now.)
Sure, however I'm not at my development workstation right now. Give me a few hours and once I am home I will post the code.
Thanks Dave! My map's reflecting location properly. Now, it's VERY simple to find the ZIP/postal code. The only part of the code I changed was adding a IBOutlet to a label (zipLabel) although I'm sure you'd like to do so programatically and setting its text as the annotation's postal code. Let me know if I left something out!
I was looking for the refresh map and this solution works for me:
[self performSelectorOnMainThread:@selector(refreshMapa) withObject:nil waitUntilDone:false];
Hope it helps,
Regards.
Quote:
Originally Posted by SlumRf
Hi all !
I need help
I have an MapView with annotations. The annotation's location can change in real time. Every 5 seconds, my app get a XML file and change the mapview list annotation coordinates.
But the problem is : annotation's coordinates really change but map view needs a user action to refresh the map (moving, zooming in, zooming out, ...). So how could I do a automatic mapView refresh ? (something like [mapView refresh] would be perfect )