我可以通過Objective-C使用最新的Graph API成功上傳視頻到Facebook。不過,我還想標記視頻中的某些Facebook用戶。我無法得到這個工作。如何使用Graph API將視頻上傳到Facebook時指定標籤
FB documentation表示有一個「標籤」字段接受包含id和名稱字段的對象數組。但是,如果我嘗試以此格式傳遞JSON字符串,則視頻上傳將失敗,並且不會顯示任何有用的錯誤消息。我是否正確傳遞標籤數據?
以下是失敗的示例代碼。當我從params中刪除@「tags」字段,或將tagStr設置爲空數組,即@「[]」時,代碼成功。
NSString *tagStr = @"[{\"id\":\"<id-removed>\", \"name\":\"<name-removed>\"}]";
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
data, @"video.mov",
@"video/quicktime", @"contentType",
titleStr, @"title",
descStr, @"description",
tagStr, @"tags", // specifying tags fails
nil];
[facebook requestWithGraphPath:@"me/videos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];