MKMapView reload/refresh on 3.1.2 and upwards - iphone

I know many people have had the similar issues and some have sorted them and others not. Basically I need some way to refresh the map ie get a callback to mapViewDidFinishLoading. If the location displayed has already been seen by the user it seemd the map is loaded from the cache and doesnt call mapViewDidFinishLoading which I need it to do because this fires some of my game code. Does anyone know how to do this on ios 3.1.2 and upwards? [Something along the lines of [mapView reload] (if only it were so simple).
Many thanks
Jules

I suppose the map's loading is triggered by the user dragging the map so you could use the mapView:regionDidChangeAnimated: callback and include your game code in it.

Don't know if you still need this, but I had a similar problem with viewForOverlay not being called. Actually it eventually got called, but too late for what I needed.
using the following it updated when I needed it to -
[self.map setVisibleMapRect:myMapRect];

Related

In-app tutorial

Im looking at adding a tutorial kind of thing to my app. Basically I want to be able to give a quick message across of what the parts in the app do. I want the users to see it once and not again. I have searched relentlessly for this but I always found app building tutorials.
A lot of games have what I want but I cannot for the life of me find how to do it or, what it is called to find a tutorial. Could someone please help me out.
Thanks in advance,
Sam
You'll need to build it yourself.
What I usually do is, on top of the view i want to explain, add a semi transparent view with some arrows pointing at stuff and a small text/button explaining it. All of that has to be modal and you can save in the NSUserDefaults if the user has already seen it/skipped it/launched the app for the first time. You'd have a method that builds all those views and you simply call it in viewDidLoad (by checking against a simple boolean value store in those previously mentioned NSUserDefaults, for example)

MKMapView userTrackingMode overridden by CLSqliteDatabaseManager

I am setting the userTrackingMode of an MKMapView instance in my UIViewController's viewLoaded method. The first time the view loads I set it to MKUserTrackingModeFollowWithHeading successfully. However every subsequent time the view loads, though I again set its value to MKUserTrackingModeFollowWithHeading, this is almost immediately overritten by MKUserTrackingModeNone. I have subclassed MKMapView and overridden setUserTrackingMode, inserting a breakpoint so I can see where it is being called from. The same thing happens in both simulator and on device:
On simulator I get the following from the stack when the value is set to MKUserTrackingModeNone:
On my device (iPhone 4s) I get the following:
There is very little else going on in my application and certainly nothing that is directly triggering the property to be set. What is CLSqliteDatabaseManager? Google returns not a single result. On the device how on earth can MKMapRectContainsRect be involved? I'm using iOS 5.0.
It seems too late to answer. But it may still be helpful for whoever is looking for an answer.
I had exactly same problem. Suddenly I figure out why. Please load your iOS build-in Maps app and click the small arrow button at bottom-left corner to start tracking your location. As soon as you drag the map. The tracking is stopped. Same reason, if you move the map in your code, the MKMapView property userTrackingMode will be reset to MKUserTrackingModeNone automatically.
In my case, I called setCenterCoordinate after set userTrackingMode to MKUserTrackingModeFollow in - (void)viewWillAppear:(BOOL)animated. It worked fine after moving around the code mapView.userTrackingMode = MKUserTrackingModeFollow; to the end.

tap back immediately after moving the map crashes application in iPhone

I came across the scenario where in if after moving the map immediately if I tap on back icon while the map has not fully loaded
The application crashes.
What I can understand is Since the loading is still in progress and I tap back the the application releases the controller but the google map loads asynchronously in NSRUNloop (not sure). So that might be the problem not sure though.
So does anybody know what can be the issue and is there any way to solve this issue?
Please comment if more description required.
It sounds like that when you close the view, the object that is the delegate for the completed map load has been deallocated, causing the crash with a bad access.
A good way to get to the bottom of these types of crashes is to use Instruments (part of the Xcode suite to tools) and go zombie hunting.
For anyone who is still searching for the answer
What exactly happening was that map view events were getting fired even if the controller was released causing a crash in the app.
So the solution is Before setting the value of objMKMapView to nil you need to set value of objMKMapView.delegate to nil.

MKMapViewDelegate notifing when user moved the map

I use an MKMapView in my application, and implement its delegate. As with the Google Maps, I want to know when the user moved the map.
If you open the Google Maps application, and press the GPS icon the button is set to the DONE style and the map centers to your location. Whenever you move the map the icon automatically gets back to PLAIN style.
How can I do the same thing?
Best regards,
Paul Peelen
I am not sure whether this will solve your problem. But try overriding regionDidChangeAnimated: method of MKMapViewDelegate.
Doc says: This method is called whenever the currently displayed map region changes. During scrolling, this method may be called many times to report updates to the map position. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting scrolling performance.

iPhone SDK: ReverseGeocoder updates too late?

I am using reverseGeocoder in a few places in my app. This particular instance, I am using it to update details about my annotation. I have created a property (MKPlacemark) which stores the new placemark each time the didFindPlacemark method runs.
The problem is, it always seems to be behind by one update. Meaning, when my custom method calls my geoCoderPlacemark property, which gets updated from the didFindPlacemark method. It returns the info for the LAST coordinates that I looked up, not the current. So, it seems that somehow, that the didFindPlacemark method runs AFTER I recieve my property, when I assumed it was running BEFORE, so that I could get the updated placemark into another method.
What is the best way to go about doing this, and avoid this problem? I really don't want to have to put all my code info the didFindPlacemark method. It seems to much easier to have that method just update a property, but why would it update this AFTER I try to get it?
I moved my code into the did didFindPlacemark and this has fixed my problem.