Advertise here




Advertise here

Howdy, Stranger!

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

Losing imageData for contact when adding to array

DesdichadoDesdichado Posts: 74Registered Users
edited October 2010 in iPhone SDK Development
Hi,

I am creating an array of address book using a method like so:
- (NSMutableArray *)getAllContacts {

    ABAddressBookRef ab = ABAddressBookCreate();
    NSMutableArray *retVal = [(NSMutableArray *)ABAddressBookCopyArrayOfAllPeople(ab) autorelease];

    CFRelease(ab)

    return retVal;
}


This works just fine, and if in my main method I do this:
    NSMutableArray *contactsArray = [self getAllContacts];

   for (id contact in contactsArray) {

        if (ABPersonHasImageData(contact)) {
            NSLog(@"Contact has image data");
        }
    }


This also works just fine, and for every contact with an image I see the log statement. My problem is that if I use an accessor to set a property of my tableViewController using the same method, I no longer get the NSLog messages.
    myTableViewController.contactsArray = [self getAllContacts];

   for (id contact in myTableViewController.contactsArray) {

        if (ABPersonHasImageData(contact)) {
            NSLog(@"Contact has image data"); //I never see this
        }
    }


Everything else with the tableViewController's array works fine - I can see a list of contacts in my table, select the contact etc, I just don't get any image data any more.

Can anybody tell me why this might be happening?
Thanks
Sign In or Register to comment.