0

Having set its nameDoubleAction and target, the ABPeoplePickerView behaves as expected when you double-click on a name. There is also a column for properties - you can add properties such as email and phone at design time in the attributes inspector. It works rather well, even for multi value properties, such as multiple phone numbers for a person. The appearance suggests that double-click should work even if you happen to click in the property column.

However I've found in my real-world applications that if you double click in the properties column the app hangs.

// action called by double clicking on people picker or by OK button
- (IBAction)acnPickerDoubleClick:(id)sender {

Execution hangs on the above line, with the debugger reporting EX_BAD_ACCESS and sender is 0x0.

I've constructed four test apps with minimal code. 2 and 4 work fine, and 1 and 3 crash as above. The 3 and 4 are identical as far as I can see, having been created within minutes of each other; the code was just copied from one to the other. Yet first one crashes, and the second one is fine. The only difference could be the order in which I created things in the Xib, added the AddressBook framework or wrote the #imports.

Another absurdity is that I only need to import AddressBook/AddressBook.h for the complier to accept this line:

@property (strong) IBOutlet ABPeoplePickerView *picker;

There seems to be no need to import AddressBook/ABPeoplePickerView.h as well, yet my real world app won't compile without adding the latter.

AlexT
  • 596
  • 7
  • 15

1 Answers1

0

I ran into the same problem and fixed it by changing my method signature to:

- (IBAction)acnPickerDoubleClick:(id __unsafe_unretained)sender {

and it seemed to work. The actual sender in the picker view hierarchy must not stick around long enough by the time the action is called. I'm using __unsafe_unretained because I'm targeting 10.6+ but you might be able to get away with __weak on a 10.7+ project.

tullera
  • 46
  • 2