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