kCGImagePropertyExifDictionary 引用错误

kCGImagePropertyExifDictionary 引用错误

使用 AVFoundation拍照

    //获取图片
    [outputImage captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
        CFDictionaryRef exifAttachments = CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, nil);
        if (exifAttachments) {
        }
        // 获取图片数据
        NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
        UIImage *thePhoto = [[[UIImage alloc] initWithData:imageData] autorelease];
        smallInfoImage.image = thePhoto;
        
        
        //保存图片到本地及数据库;
        [self writeImageToFile:thePhoto];
        


        
        

    }];

错误:kCGImagePropertyExifDictionary", referenced from

修复方法:

添加库

  • ImageIO.framework
  • #import <ImageIO/CGImageProperties.h>

原文地址:https://www.cnblogs.com/cocoajin/p/3607818.html