开发者

iOS - Issues adding kCGImagePropertyExifUserComment to image

开发者 https://www.devze.com 2023-02-19 01:46 出处:网络
I\'m having problems writing a kCGImagePropertyExifUserComment to my image. My code (overall) works, as it writes GPS coordinates without a hassle. However, writing some additional info in the UserCom

I'm having problems writing a kCGImagePropertyExifUserComment to my image. My code (overall) works, as it writes GPS coordinates without a hassle. However, writing some additional info in the UserComment field is non-working (and I'm not sure why). Code is:

CFDictionarySetValue(mutable, kCGImagePropertyExifUserComment, [NSString stringWithFormat:@"%0开发者_StackOverflow社区.0f,%0.0f,%0.0f",yaw,pitch,roll]);

Anyone have an idea on this?


If anyone else is wondering how to do this, I've finally figured it out:

NSDictionary *etcDict=[NSDictionary dictionaryWithObjectsAndKeys:
                               [NSString stringWithFormat:@"%0.0f,%0.0f,%0.0f",yaw,pitch,roll],kCGImagePropertyExifUserComment,
                               nil];
CFDictionarySetValue(mutable, kCGImagePropertyExifDictionary, etcDict);

Strange, but it works just fine!

0

精彩评论

暂无评论...
验证码 换一张
取 消