FBConnect facebook.stream.publish与NSDictionary问题 [英] FBConnect facebook.stream.publish with NSDictionary problems
本文介绍了FBConnect facebook.stream.publish与NSDictionary问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个代码,直到现在才能发送Facebook请求。
I have this code that can't send a Facebook request until now.
NSDictionary *firstDict = [NSDictionary dictionaryWithObjectsAndKeys:
@"image", @"Type",
@"http://mysite.com/image.jpg", @"src",
@"http://mysite.com/page.html", @"href",
nil];
NSDictionary *secondDict = [NSDictionary dictionaryWithObjectsAndKeys:
@"image", @"Type",
@"http://mysite.com/image.jpg", @"src",
@"http://mysite.com/page.html", @"href",
nil];
NSArray *mediaArray = [[NSArray alloc] initWithObjects:firstDict, secondDict, nil];
NSArray *keys = [NSArray arrayWithObjects:@"name", @"description", @"href", @"media", nil];
NSArray *objects = [NSArray arrayWithObjects:
[NSString stringWithString:@"MyTitle"],
[NSString stringWithString:@"My caption"],
[NSString stringWithString:@"http://mysite.com/page.html"], mediaArray, nil];
NSDictionary *attachment = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
[[FBRequest requestWithDelegate:self] call:@"facebook.stream.publish" params:attachment];
我拿这个样本: http://forum.developers.facebook.com/viewtopic.php?pid=145965
但是每次我运行它,控制台显示如下:
But every time I run it, the console shows the following:
{
"api_key" = adc8d70987098sdc;
"call_id" = 23456767;
description = "Any user's description";
format = XML;
href = "http://mysite.com/page.html";
media = (
{
Type = image;
href = "http://mysite.com/page.html";
src = "http://mysite.com/image.jpg";
},
{
Type = image;
href = "http://mysite.com/page.html";
src = "http://mysite.com/image.jpg";
}
);
method = "Facebook.streamPublish";
name = aName;
"session_key" = "d0f98bfs89b7fg7v";
sig = 89v0d9fv879fgv;
ss = 1;
v = "1.0"; }
它显示数组的括号,而不是括号,是否正常?
It shows parentheses for array instead brackets, is that normal?.
然后它显示错误:
*** -[NSCFArray dataUsingEncoding:]: unrecognized selector sent to instance
0x12fcb0 2009-10-30 13:54:27.758 GeoPixr[307:207]
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
*** -[NSCFArray dataUsingEncoding:]: unrecognized selector sent to instance 0x12fcb0
< 。
The [session resume] call returns TRUE.
提前感谢。
推荐答案
一个发送数组字典的方法,但有另一个类为我工作:
I couldn't find a way to send the dictionary with an array but there's another class that works for me:
FBStreamDialog
这会在发送信息之前打开一个对话框,通过代理方法可以了解更改。
Which brings up a dialog before it sends the information and it's delegate methods lets you know about changes.
这篇关于FBConnect facebook.stream.publish与NSDictionary问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文