2011-03-23 24 views
1

我在寫入kCGImagePropertyExifUserComment到我的圖像時遇到問題。我的代碼(總體)工作,因爲它寫GPS座標沒有麻煩。但是,在UserComment字段中寫入一些附加信息是不起作用的(我不確定爲什麼)。代碼是:iOS - 將kCGImagePropertyExifUserComment添加到圖像的問題

CFDictionarySetValue(mutable, kCGImagePropertyExifUserComment, [NSString stringWithFormat:@"%0.0f,%0.0f,%0.0f",yaw,pitch,roll]); 

任何人有這樣的想法?

回答

4

如果任何人想知道如何做到這一點,我終於想通了:

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

奇怪,但它工作得很好!

+0

我在http://stackoverflow.com/questions/42468315/how-do-i-record-a-maker-note-or-user-comment-in-exif嘗試了你的建議,但它沒有奏效。我究竟做錯了什麼? – 2017-02-26 12:26:21