views:

614

answers:

1

Hello,

I use ABUnknownPersonViewController to display a contact view.

I try to set an image with:

NSData *dataRef = UIImagePNGRepresentation([UIImage imageNamed:@"contact3.png"]);
ABPersonSetImageData(newPersonViewController.displayedPerson, (CFDataRef)dataRef, nil);

It doesn't work and I don't know why. Any ideas?

+4  A: 
Perspx
Thank you Perspx. Good hint. I thought in Cocoa-Touch would be toll-free bridging between them (as in Cocoa). Nevertheless, I've just tried to create a fresh CFDataRef by your snippet. It's the same thing. Strange, I get no error back from ABPersonSetImageData.
Stefan
Ok, I've got it. It was the image. Some of them don't work. Thanks for your help
Stefan
No worries - glad you fixed it.
Perspx
Also, remember to call ABAddressBookSave, or none of your changes will stick!
David Maymudes