Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

breakpoint in getting phone Numbers property

dannyandbassDevdannyandbassDev Posts: 2New Users
edited May 2012 in iPhone SDK Development
hi, i am keep getting breakpoints when i try to get phoneNumberPropety by Name


-(void)textMessage{
NSMutableArray *phoneNumbers = [[[NSMutableArray alloc]init]autorelease];
ABAddressBookRef addressBook = ABAddressBookCreate();
for(NSString *name in savedPeople){
CFArrayRef people = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)name);
ABMultiValueRef multiPhones = ABRecordCopyValue(people, kABPersonPhoneProperty);
}
CFRelease(addressBook);
}



here is an image
Screen Shot 2012-05-01 at 11.20.48 AM - Minus
Post edited by dannyandbassDev on

Replies

  • Duncan CDuncan C Posts: 8,139Tutorial Authors, Registered Users
    edited May 2012
    dannyandbassDev;429017 said:
    hi, i am keep getting breakpoints when i try to get phoneNumberPropety by Name


    -(void)textMessage{
    NSMutableArray *phoneNumbers = [[[NSMutableArray alloc]init]autorelease];
    ABAddressBookRef addressBook = ABAddressBookCreate();
    for(NSString *name in savedPeople){
    CFArrayRef people = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)name);
    ABMultiValueRef multiPhones = ABRecordCopyValue(people, kABPersonPhoneProperty);
    }
    CFRelease(addressBook);
    }



    here is an image
    Screen Shot 2012-05-01 at 11.20.48 AM - Minus

    You create an array (CFArrayRef) of people with the call to ABAddressBookCopyPeopleWithName.

    In the next call, you call ABRecordCopyValue. According to the docs, that call wants an ABRecordRef as its first parameter.

    You are passing it an array instead of an ABRecordRef. That is why you are crashing.

    I've never used the address book before, but I found the problem in about 30 seconds. The Xcode documentation is your friend. Use it.
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • dannyandbassDevdannyandbassDev Posts: 2New Users
    edited May 2012
    -(void)textMessage{
    NSMutableArray *phoneNumbers = [[[NSMutableArray alloc]init]autorelease];
    ABAddressBookRef addressBook = ABAddressBookCreate();
    for(NSString *name in savedPeople){
    CFArrayRef people = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)name);
    ABMultiValueRef multiPhones = ABRecordCopyValue((ABRecordRef)people, kABPersonPhoneProperty);
    }
    CFRelease(addressBook);
    }


    i had the typecast up before too, but i am still getting breakpoints
  • Duncan CDuncan C Posts: 8,139Tutorial Authors, Registered Users
    edited May 2012
    dannyandbassDev;429022 said:
    -(void)textMessage{
    NSMutableArray *phoneNumbers = [[[NSMutableArray alloc]init]autorelease];
    ABAddressBookRef addressBook = ABAddressBookCreate();
    for(NSString *name in savedPeople){
    CFArrayRef people = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)name);
    ABMultiValueRef multiPhones = ABRecordCopyValue((ABRecordRef)people, kABPersonPhoneProperty);
    }
    CFRelease(addressBook);
    }


    i had the typecast up before too, but i am still getting breakpoints
    Typecasting an object does not make it the type that you want. You need to pass the correct type of object into ABRecordCopyValue, or it will crash.
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
Sign In or Register to comment.