iOS – 将kCGImagePropertyExifUserComment添加到图像的问题
我在将kCGImagePropertyExifUserComment写入图像时遇到问题。 我的代码(整体)工作,因为它没有麻烦地写GPS坐标。 但是,在UserComment字段中写一些其他信息是不起作用的(我不知道为什么)。 代码是:
CFDictionarySetValue(mutable, kCGImagePropertyExifUserComment, [NSString stringWithFormat:@"%0.0f,%0.0f,%0.0f",yaw,pitch,roll]);
有人对此有所了解吗?
如果有人想知道如何做到这一点,我终于明白了:
NSDictionary *etcDict=[NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat:@"%0.0f,%0.0f,%0.0f",yaw,pitch,roll],kCGImagePropertyExifUserComment, nil]; CFDictionarySetValue(mutable, kCGImagePropertyExifDictionary, etcDict);
奇怪,但它工作得很好!