iPhone SDK: ReverseGeocoder updates too late? - iphone

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.

Related

locationManager:didUpdateToLocation:fromLocation not getting called for Significant Location Changes Monitoring

I implemented background location tracking using standard location services, and it works fine. However, since this implementation uses a lot of power, I decided to switch to significant location changes monitoring. Basically, I just changed all the calls to startUpdatingLocation to startMonitoringSignificantLocationChanges and reused the CLLocationManagerDelegate methods I have implemented before.
The problem is that after switching to significant location changes monitoring, the delegate method locationManager:didUpdateToLocation:fromLocation only gets called once when I start monitoring, and is never called again afterwards. I have moved around the phone for a couple of kilometers, and tried riding a train with it, but still the method never gets called. Am I missing something here? Are there settings I need to enable or special code I need to write in order for this to work?
Thanks!
The significant location change requires cell phone towers in order to operate. If you don't have cell phone reception you will not get any results. You can also call CLLocationManager's significantLocationChangeMonitoringAvailable method to see if it is available.

Zombie CADisplayLink?

Is it possible that a CADisplayLink gets called one or two more times even after being invalidated?
It looks that way to me, and this is causing me a problem because the target object is called where it's already gone so it crashes.
Thanks!
According to the docs, "The newly constructed display link retains the target." so it shouldn't crash in any case.
EDIT: Try setting the environment variables NSZombieEnabled=YES and NSDeallocateZombies=NO (the latter is the default, apparently), which may help debug the crash.

MKMapView reload/refresh on 3.1.2 and upwards

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];

Is it possible to call a method automatically every time a value changes?

i.e. I have a layer's "transform.rotation.z" value which may change several times. Every time that value changes, I'd like to call a method. Of course I could call it just at any point where I touch that value. But maybe there's a more elegant way in objective-c / cocoa-touch? Somebody told me a few days ago that there's some notification mechanism available. But is that useful for something like this? How would it look like?
I think what you want is Key-Value Observing.

NSTimer with Touch capability? Any other options

I am creating my very first iphone app and need help here. My programming background is not C and I am bit lost.
Basically what I want my application to do is to display random bitmaps and let user touch individual bitmap and validate them. The method I used to display the bitmaps is NSTimer with UIImage for the actual bitmaps. So far, it was working fine in displaying the bitmap. But I am stuck on the next step, which is registering the touched bitmaps. I tried to use tag on the bitmap then touchesBegan function. I got a runtime error everytime I touched screen (I think.)
My questions are:
1. Given my requirement, is the method I am using is a good method, or even technically possible?
2. If q#1 answer is no, do you have alternative solution?
Thanks and I appreciate your help!
If you're getting an exception inside your touchesBegan: function, then your code there has a bug in it. If you run your app with the debugger, it should tell you on exactly what line of code the problem is occurring. If I had to guess, I would say that you're trying to send a message to an object which doesn't handle that message, which throws an exception.
Make sure your code is compiling without any warnings -- it's possible you have a typo in a function name somewhere. If you misspell the message name, it will still compile correctly, but it will throw an exception at runtime when you try to send that message.