I'm pretty new to Objective-C, so I'm sorry in advance if I'm missing something you would consider obvious :)
I wrote a simple program to display the Address Book, and select a user(mimicking the iOS Contact list).
I have a basic controller:
@interface BasicViewController :
UIViewController<ABPersonViewControllerDelegate>
The controller recieves an ABRecordRef from a previous view. In one of my methods, I use:
ABPersonViewController* ctrl = [[ABPersonViewController alloc]init];
ctrl.allowsEditing = NO;
[ctrl setPersonViewDelegate:self];
[ctrl setDisplaydPerson:person];
[self setView:ctrl.view];
[self.navigationController pushViewController:ctrl animated:
YES];
When I get to the actual view, I get a blank screen(with the background associated with an ABPersonView). I fiddled a bit with displayedProperties:
ctrl.displayedProperties = [NSArray arraywithObjects:
[NSNumber numberWithInt:kABPersonLastNameProperty],nil];
When I specified that I only wanted to see the last name - a message appeared on the same view - NO_VALUE_UNKNOWN
I checked in debug, and my ABRecordRef isn't null, and contains all of the relevant strings.
Any ideas?
Solved it :) I called a method containing the code displayed above from a segue. the viewDidLoad method of the super wasn't called until after my method was.
when I rearranged the calling order, it worked like a charm :)