你好,我想要检索我发布的所有墙贴,直到现在我正在使用我的原生iphone应用程序中的这个fql查询才能获取它,但我想我是一些错误请指导我怎么可能这样做以下是我的fql查询获取墙贴
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
NSString *fql = [NSString stringWithFormat:@"SELECT comments, likes FROM stream WHERE post_id=100000182297319"];
NSLog(@"session key is %@",_session.sessionKey);
NSLog(@"from global key is %@",[twitfacedemoAppDelegate getfacebookkey]);
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];
[[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];
这是我的其他delgate方法来获取墙贴,但此代码无效
- (void)request:(FBRequest*)request didLoad:(id)result {
@try
{
NSLog(@"result is %@",result);
if(result==nil)
{
UIAlertView *a=[[UIAlertView alloc]initWithTitle:@"Can't login" message:@"You cant login here." delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[a show];
[a release];
}
else
{
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
NSString* name = [[NSString alloc]initWithString:[user objectForKey:@"name"]];
NSLog(@"name is %@",name);
_label.text = [NSString stringWithFormat:@"Logged in as %@", name];
NSString *globalfacebookname;
globalfacebookname=[[NSString alloc]initWithString:name];
NSLog(@"value is %@",globalfacebookname);
NSString *fid=[user objectForKey:@"uid"];
NSLog(@"FACEBOOK ID WITH STRING DATATYP %@",fid);
[twitfacedemoAppDelegate fetchfacebookid:fid];
}
}
@catch (NSException * e)
{
NSLog(@"Problem in dialog didFailWithError:%@",e);
}
}
请指导我如何通过fql查询从facebook查找我的所有帖子到我的本机iphone应用程序
提前致谢
答案 0 :(得分:2)
答案 1 :(得分:1)
欢呼我得到它我在建立连接后解决了一个问题,我将我的墙贴回到原生iphone应用程序这里是我的查询
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
//_permissionButton.hidden = NO;
//_feedButton.hidden = NO;
NSLog(@"DISABLED");
NSString *fql = [NSString stringWithFormat:@"SELECT actor_id, message FROM stream WHERE source_id = 100000182297319 limit 50"];
NSLog(@"session key is %@",_session.sessionKey);
NSLog(@"from global key is %@",[twitfacedemoAppDelegate getfacebookkey]);
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];
[[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];
}
,这是它的结果
- (void)request:(FBRequest*)request didLoad:(id)result {
@try
{
NSLog(@"result is %@",result);
//startride.enabled=FALSE;
//selectride.enabled=FALSE;
if(result==nil)
{
UIAlertView *a=[[UIAlertView alloc]initWithTitle:@"Can't login" message:@"You cant login here." delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[a show];
[a release];
}
else
{
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
}
}
@catch (NSException * e)
{
NSLog(@"Problem in dialog didFailWithError:%@",e);
}
}
此时您将获得结果字典
中的所有墙贴答案 2 :(得分:1)
也许我迟钝但我尝试了这个,我总是得到一个空的NSArray。我用我的uid替换了我的source_id显然是%lld,在我请求之前我已成功从我的个人资料中获取我的全名(所以我必须通过身份验证)。这是我正在使用的确切查询:SELECT actor_id,message FROM stream WHERE source_id = 610611343 limit 50
我是否必须首先请求权限?非常感谢帮助,因为我已经花了好几个小时就想把头发拉出来。我希望错误代码至少会回来 - 但它总是一无所获。