在 iOS 上通过 Facebook Graph API 使用“Like" [英] Using 'Like' with the Facebook Graph API on iOS

查看:26
本文介绍了在 iOS 上通过 Facebook Graph API 使用“Like"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新的 Facebook SDK for iOS 和 Graph API.效果很好.

I am using the latest Facebook SDK for iOS and Graph API. Works Great.

我正在尝试喜欢"状态更新,执行以下操作:

I'm trying to 'Like' status updates, doing the following:

NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];
NSString *messageID = (NSString*)[managedObject valueForKey:@"message_id"];

NSLog(@"Like: %@", [NSString stringWithFormat:@"%@/likes", messageID]);

[facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/likes", messageID] andParams:nil andHttpMethod:@"POST" andDelegate:self];

但是这会从 Facebook 返回一个错误:

However this returns an error from Facebook:

facebookErrDomain 错误 10000.

facebookErrDomain error 10000.

有人知道这是为什么吗?

Anyone know why this is?

推荐答案

想通了.您不能将 nil 传递给参数.所以我创建了一个空的 NSMutableDictionary,并传递了它.工作得很好.(顺便说一句:不可能以这种方式喜欢页面.)

Figured it out. You cannot pass nil to the parameters. So I created an empty NSMutableDictionary, and passed that. Worked fine. (By the way: it’s not possible to like a page this way.)

这篇关于在 iOS 上通过 Facebook Graph API 使用“Like"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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