如何使用iOS社交框架阅读任何facebook用户的公共时间线?
我真的花了几个小时试图解决这个问题,但没有成功! 我只想能够阅读任何用户的时间线(公共消息)从facebook。。。 从技术上讲(为了简单起见),我更喜欢只使用iOS sdk中的框架(即不必使用facebook的框架)。因此,我目前只使用Social.framework和Accounts.framework 到目前为止,我成功地读取了当前登录用户(设备上标识的用户)的facebook时间线,但当我试图用以下url@“”中的“另一个用户ID”替换“我”时,它只返回一个空数据字段(无“消息”节点) “奇怪”的事实是,我可以使用@成功地访问任何公司类型的提要(例如“cocacola”) 所以我的问题是如何到达一个“简单”用户的提要(例如“shireesh.asthana”),以便我可以阅读它的“消息” 到目前为止,我的过程是:如何使用iOS社交框架阅读任何facebook用户的公共时间线?,ios,objective-c,facebook,facebook-graph-api,facebook-ios-sdk,Ios,Objective C,Facebook,Facebook Graph Api,Facebook Ios Sdk,我真的花了几个小时试图解决这个问题,但没有成功! 我只想能够阅读任何用户的时间线(公共消息)从facebook。。。 从技术上讲(为了简单起见),我更喜欢只使用iOS sdk中的框架(即不必使用facebook的框架)。因此,我目前只使用Social.framework和Accounts.framework 到目前为止,我成功地读取了当前登录用户(设备上标识的用户)的facebook时间线,但当我试图用以下url@“”中的“另一个用户ID”替换“我”时,它只返回一个空数据字段(无“消息”节点)
ACAccountStore *account = [[ACAccountStore alloc] init];
ACAccountType *accountType = [account
accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
// Specify App ID and permissions
NSDictionary *options = @{
ACFacebookAppIdKey: @"1111111111111", // My AppID here
//ACFacebookPermissionsKey: @[@"read_stream"],
ACFacebookPermissionsKey: @[@"email", @"read_stream"],
ACFacebookAudienceKey:ACFacebookAudienceFriends
};
[account requestAccessToAccountsWithType:accountType
options:options completion:^(BOOL granted, NSError *error)
{
if (granted == YES)
{
NSArray *arrayOfAccounts = [account
accountsWithAccountType:accountType];
if ([arrayOfAccounts count] > 0)
{
ACAccount *facebookAccount = [arrayOfAccounts lastObject];
// I want the messages and the author
NSDictionary *parameters = @{@"fields": @"message,from"};
NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/HERE_THE_USER_ID/feed"]; // Work with "cocacola" but not with "shireesh.asthana"
SLRequest *getRequest = [SLRequest
requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:feedURL
parameters:parameters];
getRequest.account = facebookAccount;
[getRequest performRequestWithHandler:
^(NSData *responseData, NSHTTPURLResponse
*urlResponse, NSError *error)
{
dataSource = [NSJSONSerialization
JSONObjectWithData:responseData
options:NSJSONReadingMutableLeaves
error:&error];
// Reach the main queue to process result
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Read %d messages", [dataSource[@"data"] count]);
if ([dataSource[@"data"] count] != 0) {
// Do stuff in case of success...
} else {
// Do stuff in case of ERROR...
}
});
}];
} else {
// Case of no facebook account on the device...
}
} else {
// User don't grant the app to access its facebook info...
}
}];
所以我的问题是如何到达一个“简单”用户的提要(例如“shireesh.asthana”),以便我可以阅读它的“消息”
原因可能是-
没有公共职位
在中有关闭平台
不是会话中的用户)
p.S.Shireesh Asthana(在Facebook工作),没有任何公开帖子谢谢你的帖子。关于“Shireesh Asthana”的feed,我指的是它自己的帖子:但是你完全正确,因为现在它的feed上没有公开信息。我很高兴它有帮助。干杯