我收到错误:“提供的模板数据未涵盖发布故事所需的整个令牌集”
我的模板是:“
{*actor*} just scored {*points*} points.
”
我的代码是:
NSMutableDictionary* feedStoryParams = [[[NSMutableDictionary alloc] init] autorelease];
[feedStoryParams setObject:<MyBundle ID> forKey:@"template_bundle_id"];
[feedStoryParams setObject:[NSString stringWithFormat:@"\"points\":\"42\""] forKey:@"template_data"];
[[FBRequest requestWithDelegate:self] call:@"Feed.publishUserAction" params:feedStoryParams];
这是用户在我的 iPhone 应用程序中登录 Facebook 后的情况(我检查以确保会话 ID 存在)。
我还通过从字典中删除“points”条目来测试它,然后它给了我正确的错误,指出{points}条目丢失并且是模板“
{*actor*} just scored {*points*} points.
”所必需的。所以我也知道模板包 ID 是正确的。
为什么这不起作用?
我也有同样的问题。将所有内容放入显式 JSON 哈希中即可修复此问题。尝试更换
[feedStoryParams setObject:[NSString stringWithFormat:@"\"points\":\"42\""] forKey:@"template_data"];
与
[feedStoryParams setObject:[NSString stringWithFormat:@"{\"points\":\"42\"}"] forKey:@"template_data"];
“演员”应该出现在 template_data 中的某个位置吗?