ABPersonViewController not locating address on map - ios5

Any ideas as to why presenting an ABPersonViewController with its delegate won't locate an address of a selected person on the map?
Currently, the app just quits to Maps and stays there zoomed out.
The code for the ABPersonViewController delegate just returns YES to any action performed on a contact, and, if I manually copy the person's address and paste it into the maps app, the given address is found without any issues.
Is there something I'm missing?
Thanks!

Related

Adding User Location Alert on MapView Loading - Xcode

I am working on Map View project but when my app loads up i get this alert on the very first screen
'"Project Name Would Like to Use Your Current Location"(Alert Message) "Don't Allow"(button) "OK"(button)'(Location Alert Box)
before the Map View it shows me alert on the first view i want when i switch to Map View then only the alert should come up so that at that time user can click "OK" and App will be able to use the location of user, i have searched alot but did not found some good ways to do it, i know it can be done because i have seen one or two app doing that thing but i am not able to do this feature in my app ... plz help me out in this...
I just want that the alert of location search should only show up when i reach on map view screen of my application not before that .. any suggestions ?? coding will be much appreciated.
You can simply not instantiate your CLLocationManager until you reach the screen where you want the alert to appear. It is the instantiation of the location manager that is prompting the OS to display the alert.
As GeraldWilliam already explained, its the CLLocationManager that forces the popup, which you cannot alter.
However, what you could do is show the mapview and ask the user for its current location when the view is loaded, e.g. using the – viewDidAppear: method.

Global notification banners (Like GameKit banners)

I have created a drop down banner system, like GameKits (When you get an achievement for example).
I can easily display the banner in one view with the code below. However, all my server code is stored in a singleton class, and would like to notify the user when something happens in there (regardless what view controller they are in). How would I go about doing this?
[self displayBannerWithTitle: #"title here"];
Thanks in advance

iPhone [self performseguewithidentifier... ] is not showing the new view controller

I have been all over stackoverflow and all over Google and I cannot seem to figure this one out. Here's my scenario:
I have my app's "main screen" where the user first makes decisions about what they're going to do. The app works off of a CoreData database which is created by "importing" XML files. The user can choose to open an XML file attached to an email in my application, which automatically triggers my main screen to show up and run the import of the file.
I can get this far without any issues. In my storyboard, I have a segue called ParseSegue from my main screen to a view controller which will handle the parsing and give the user some status information.
When the main screen is called via the email app, the main screen automatically calls
[self performSegueWithIdentifier:#"ParseSegue" sender:self];
I then check for this segue name in prepareForSegue and it's a valid name. This is where I assign the file URL to the parser controller so that it can parse the correct file.
The problem is that the segue never actually happens. The prepareForSegue method gets called, the name "ParseSegue" can be checked against and is valid, but the segue itself simply does not happen. If I add a button to the main screen and tell it to perform the segue within the storyboard, it works fine. But calling it programmatically seems to do nothing.
It turns out that I was looking in the wrong place entirely. My problem was that in my appDelegate, where the app reacts to the incoming URL, I was inadvertently creating a new instance of my storyboard and my main view controller. This was different than the one which was already active and may or may not have been on the screen.
The controller I was creating was never actually shown. I only noticed this because the log:
NSLog(#"Source: %#", [segue.sourceViewController description]);
would show different memory addresses for my test (the button push) and the import test. This led me to believe that I was, in fact, working with two different instances of the storyboard and the app's main view controller. Thanks to Paul for the suggestion of logging the destination and the source controllers.

iPhone - Updating Annotation subtitle in mapkit

I have a custom placemark with title and subtitle. The subtitle is actually displaying the address of the dropped pin using the reverse geocoder.
I have a button which has an action to drop the pin. This action gets the location coordinates of the user, and then calls [geocoder start] which gets the full address with Reverse Geocoder and generates the custom annotation and then calls [mapView addAnnotation:customPlacemark].
My problem is that using this sequence order, when there's no a WiFi connection (only 3G or maybe Edge) the pin takes a lot to drop because it's watigin to get the reverse geocoding info.
So basically I need to drop the pin without a subtitle and from the viewDidAnnotation call the geocoder and inside the reverseGeocoder update the subtitle but I'm not sure how to do that.
I want to display the annotation without the address details and update it when it gets the information from the reverse geocoder.
Any suggestions?
Thanks in advance
MKMapView observes changes its annotations via KVO. Therefore if you update your annotation's properties in a KVO compliant manner, it should Just Work.
For example, when the reverse geocoder returns an address for your annotation, you first announce the title and subtitle properties are about to change:
[self willChangeValueForKey:#"title"];
[self willChangeValueForKey:#"subtitle"];
Note that the above code is assumed to be in the annotation class.
Then update the annotation with information from the geocoder. When you are done:
[self didChangeValueForKey:#"subtitle"];
[self didChangeValueForKey:#"title"];
Note the order changed for didChangeValueForKey: as these need to be nested properly, somewhat like HTML tags.
This also works for the coordinate property, that will cause the pin to move.
I'd place the annotation, keep a reference to it in a property, then when your reverse geocoder calls back use the reference to the annotation and update its properties.

How to detect changes to Address Book after ABPersonViewController presentation

I have two view controllers that allow changes to the Address Book.
The first one lets you add or create an entry based on an ABRedordRef or edit an existing ABRecordRef, by presentation of either ABUnknownPersonViewController or ABPersonViewController.
The second one is a standard ABPeoplePickerNavigationController that allows you to view/edit any of the contents of the Address Book.
Both views are accessible easily accessible to the use via the main application UITabBarController.
How can I determine that changes were made by either view controller, so that I can force data dependency changes to a third separate view controller.
I thought that I saw a notification center message that I could subscribe to, but I can't seem to find it again...
I don't care if the notification center is the method that should be used, or a delegate protocol or... whatever, I don't care, I just need to know how to detect the change or the need to re-sync with the Address Book.
Can someone Please point me in the right direction.
Thank you.
You can subscribe to address book changes via ABAddressBookRegisterExternalChangeCallback
See official documentation