Facebook SDK didLoad:result = null [英] Facebook SDK didLoad:result = null

查看:155
本文介绍了Facebook SDK didLoad:result = null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Facebook单身人士,并请求获取个人资料照片:

I have a Facebook singleton and request this to get a profile picture:

[[[FacebookScorer sharedInstance] facebook] requestWithGraphPath:@"me/picture?type=normal" andDelegate:self];

现在在facebooks委托方法didLoadRawResponce我实际上收到了个人资料图片,可以显示,但在didLoad: (id)result方法的结果为null!

Now in facebooks delegate method didLoadRawResponce I actually receive the profile picture and can display, but in the didLoad:(id)result method the result is null!

我相信didLoad方法在结果被解析后调用,为什么我不能从它返回任何东西?

I believe the didLoad method is called once the result has been parsed, so why do I not get anything back from it?

我需要使用didLoad的原因是,我可以问它是否结果是KindOfClass看看是什么,而didLoadRawResponce也在我注销时调用,那么如何我检查数据是什么?

The reason I need to use didLoad, is I can ask it if the result isKindOfClass to see what it is, whereas didLoadRawResponce is also called when I logout, so how can I check what the data is?

- 编辑
我已经弄清楚如何区分FBRequests,所以这不是一个很大的问题了,然而我仍然不能理解为什么didLoad被调用,但没有任何结果。
即使使用此触发器也会触发slog,但是使用null

--Edit I have figured out how to differentiate between FBRequests, so this isn't such a great problem anymore, however I still can't understand why didLoad is being called but without any result. Even using this gives triggers the slog, but with null

if (request == _profilePicRequest) {
    NSLog(@"result:%@",result);
}


推荐答案

来自请求的数据:

- (void)request:(FBRequest *)request didLoad:(id)result{
result = request.responseText;

if ([result isKindOfClass:[NSData class]])
{   
    ...
}

if ([result isKindOfClass:[NSDictionary class]])
{
    ...
}

不是最优雅的解决方案,我还是不知道为什么结果是nil。但它工作。

Not the most elegant solution, and I still don't know why the result is nil. But it works.

希望这有助于!

这篇关于Facebook SDK didLoad:result = null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆