1

For some reason, my shouldPerformDefaultActionForPerson function never gets called, in the simulator and the device. Could someone look at this and tell me what I'm missing? From all the examples I've found, I can't see what I'm doing wrong.

Here is my header:

#import <Foundation/Foundation.h>
#import <AddressBookUI/AddressBookUI.h>
#import <MessageUI/MessageUI.h>
#import "SWO.h"

@interface CustomABPersonViewController : ABPersonViewController
<MFMessageComposeViewControllerDelegate, ABPersonViewControllerDelegate>
{
    SWO *theSWO;
}

- (id)initWithSWO:(SWO *)aSWO;

@end

And here is my implementation file:

#import "CustomABPersonViewController.h"
#import <MessageUI/MessageUI.h>
#import "SWO.h"

@implementation CustomABPersonViewController

- (id)initWithSWO:(SWO *)aSWO
{
    if (self = [super init])
    {
      //Various init code
    }
    return self;
}

- (BOOL)personViewController:(ABPersonViewController *)personView shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)IdentifierForValue
{
    NSLog(@"In here!");
    return YES;
}

@end

And here is when I call in the view:

CustomABPersonViewController *view = [[CustomABPersonViewController alloc] initWithSWO:aSWO];
    view.personViewDelegate = self; 
    view.displayedPerson = aRecord;

    [self.navigationController setToolbarHidden:NO animated:NO];
    [self.navigationController pushViewController:view animated:YES];
eshrickus
  • 11
  • 1
  • How are you testing that it does not work? – Mundi Sep 25 '12 at 15:25
  • You can see in my code that the shouldPerformDefaultActionForPerson() is logging "In here!". It never shows up in the log when I try it, both in the simulator and the device. I've also tried settings the return to NO, but the default action still occurs, regardless of the property type. – eshrickus Sep 25 '12 at 15:30

1 Answers1

0

Many default actions do not work on the Simulator. You have to try them on an actual device.

Mundi
  • 79,884
  • 17
  • 117
  • 140