ABPeoplePicker Help Needed

  • The code below seg faults with the data I pass it in array. without
    calling setDisplayedProperties only contact names are sown, no email,
    phone or other fields. what am I doing wrong?

    - (void) pickPerson
    {
        struct CGRect screenRect = [UIHardware
    fullScreenApplicationContentRect];
        screenRect.origin.x = screenRect.origin.y = 0.0f;

    //    CFStringRef properties[] = { CFSTR( "kABEmailProperty" ) , CFSTR
    ( "kABPhoneProperty" ) };

    CFMutableArrayRef array = CFArrayCreateMutable( NULL, 1, NULL );
    CFArrayAppendValue(array, @"kABEmailProperty");

    ABPeoplePicker* picker = [[ABPeoplePicker alloc] initWithFrame:
    screenRect];
    [picker setAllowsCancel: YES];
    [picker setPrompt: @"Select a recipient"];
    [picker setAllowsCancel: YES];
    [picker setDelegate: self];

    [picker setDisplayedProperties: array];

    [m_mainView addSubview: picker];
    }

    Mark Kieling
    Senior Program Manager
    mobile 408.375.2125
    office 650.603.6627
    yahoo markkieling
    http://www.coremobility.com
  • Your question would be easier to answer if you clarified a few things.

    - Unless my attempt to compile your code, and a search of the
    documentation, greatly mislead me, there is no such class as
    ABPeoplePicker, nor method as setDisplayedProperties:. Posting your
    actual code, and not an approximation that can't exhibit your bug,
    would be helpful.

    - If ABPeoplePicker is a class of your own (and you shouldn't prefix
    class names with prefixes used in system-supplied classes), then, once
    again, you haven't supplied the code that actually crashes.

    - Once we have the real code, some clue as to which line crashed, the
    contents of variables at the time, and the first few (deepest) lines
    of the stack trace would be helpful.

    As an aside, I'm not sure why you use Core Foundation strings and
    arrays, but that shouldn't contribute to your bug. The array you
    choose doesn't retain its members, which will be disastrous in the
    long run, but in the case of CF/NSString constants, isn't an issue.

    — F

    On Sep 7, 2007, at 9:22 PM, Mark Kieling wrote:

    > The code below seg faults with the data I pass it in array. without
    > calling setDisplayedProperties only contact names are sown, no
    > email, phone or other fields. what am I doing wrong?
    >
    >
    > - (void) pickPerson
    > {
    > struct CGRect screenRect = [UIHardware
    > fullScreenApplicationContentRect];
    > screenRect.origin.x = screenRect.origin.y = 0.0f;
    >
    > //    CFStringRef properties[] = { CFSTR( "kABEmailProperty" ) ,
    > CFSTR( "kABPhoneProperty" ) };
    >
    > CFMutableArrayRef array = CFArrayCreateMutable( NULL, 1, NULL );
    > CFArrayAppendValue(array, @"kABEmailProperty");
    >
    > ABPeoplePicker* picker = [[ABPeoplePicker alloc] initWithFrame:
    > screenRect];
    > [picker setAllowsCancel: YES];
    > [picker setPrompt: @"Select a recipient"];
    > [picker setAllowsCancel: YES];
    > [picker setDelegate: self];
    >
    > [picker setDisplayedProperties: array];
    >
    > [m_mainView addSubview: picker];
    > }
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today