Jimmy
Jimmy

Reputation: 1104

What format is person's ImageData(CFDataRef) in AddressBook?(Jpeg or PNG)?Or how to determine?

From AddressBook's API ABPersonCopyImageData I can get a CFDateRef which is toll-free bridge to NSData. And I want to write this data to file, but what file extension should I use ? .jpeg or .png?

The documentation doesn't mention what the data is.Is there any way to know?

Upvotes: 3

Views: 222

Answers (1)

rakesh_chovatiya
rakesh_chovatiya

Reputation: 48

NSData  *imgData = (__bridge NSData *)ABPersonCopyImageData(person);
        UIImage *img = [UIImage imageWithData:imgData];
        if (!img) {
            img = [UIImage imageNamed:@"noImage.png"];
        }

Upvotes: 1

Related Questions