I'm creating an app in which i need to replace contact image of the person stored in iphone's address book from my image. Any Help??
Asked
Active
Viewed 1,047 times
1 Answers
3
UIImage *img = [UIImage imageNamed:@"yourimage.png"];
NSData *dataRef = UIImagePNGRepresentation(img);
ABPersonSetImageData(person, (CFDataRef)dataRef, nil);

PJR
- 13,052
- 13
- 64
- 104
-
i'm sorry but this is not working for me. I'm testing this in Simulator. Is their something else that i need to add in this code? – Baby Groot Aug 08 '11 at 08:54
-
ya for that you have to implement http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/AddressBook/Classes/ABPerson_Class/Reference/Reference.html – PJR Aug 08 '11 at 09:58
-
Thnx @PJR i finally solved my problem by this thread http://stackoverflow.com/questions/2082845/setting-address-book-image-for-a-contact-doesnt-seem-to-work – Baby Groot Aug 08 '11 at 10:07