我在IOS8中从设备(iphone)检索联系人时遇到问题,并用照片显示它们,请问我该如何克服这个问题? 这是我的代码
- (void) setImage: (UIImage *) image
{ CFErrorRef errorRef = NULL;
BOOL success;
if (image == nil) // remove
{ if (!ABPersonHasImageData(_record)) return;
// no image to remove success = ABPersonRemoveImageData(_record,
&errorRef); if (!success) { NSError *error =
(__bridge_transfer NSError *) errorRef; NSLog(@"Error: %@",
error.localizedFailureReason);
} return; } NSData *data = UIImagePNGRepresentation(image);
success = ABPersonSetImageData(_record, (__bridge CFDataRef) data,
&errorRef); if (!success) { NSError *error =
(__bridge_transfer NSError *) errorRef; NSLog(@"Error: %@",
error.localizedFailureReason); } return; }