也许有人无法帮助我。
我使用最后一个FBConnect(http://github.com/facebook/facebook-ios-sdk/)进行Facebook连接。 我检索了用户的相册列表。
NSMutableDictionary* params = [NSMutableDictionary NictionaryWithObjectsAndKeys:_facebook.accessToken,@"access_token",nil];
[_facebook requestWithGraphPath:@"me/albums" andParams:params andDelegate:self];
我正在测试4个不同的帐户,所有相同的隐私规则(帐户/隐私设置)。对于他们中的一些人来说,专辑列表是空的?如果我通过桌面计算机上的webbrowser(https://graph.facebook.com/me/albums)测试不能在iphone上工作的帐户,那么列表不是空的?
在iphone上,我使用图形api或FQL,结果相同(“SELECT aid FROM album WHERE owner = me()”)
也许我想念一些关于facebookapp的配置?
感谢您的回答。
答案 0 :(得分:2)
我使用facebook authentifications的良好设置解决了这个问题 http://developers.facebook.com/docs/authentication/permissions
答案 1 :(得分:0)
这将把所有相册中的图像放在源阵列中!
NSURL *url1 = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/photos&access_token=AAACeFkezepQBANpoFq9I3Hts0JdE6Xis3UpZBqNxpgw62zWSlhSYyYcluGaaxH3IlKIh9w8OYrXYF9MsAxhk6ta1ANZClCaznpdSaERgZDZD",A_ID]];
URLWithString:@"https://graph.facebook.com/114750591966408/photos&access_token=//AAACeFkezepQBANpoFq9I3Hts0JdE6Xis3UyYcluGaaxH3IlKIh9w8OYrXYF9MsAxhk6ta1ANZClCaznpdSaERgZDZD"];
NSData *data1 = [NSData dataWithContentsOfURL:url1];
NSString *str1=[[NSString alloc] initWithData:data1 encoding:NSASCIIStringEncoding];
// NSString *str1=[[NSString alloc]ini]
NSDictionary *userData1 = [str1 JSONValue];
NSArray *arrOfimages=[userData1 objectForKey:@"data"];
NSMutableArray *sourceUrls = [[NSMutableArray alloc] initWithCapacity:0];
for(NSDictionary *subDictionary in arrOfimages)
{
[sourceUrls addObject:[subDictionary objectForKey:@"picture"]];
}
答案 2 :(得分:0)
需要publish_actions和user_photos权限。
然后请尝试以下代码:
[FBRequestConnection startWithGraphPath:@"me/albums"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
// Success! Include your code to handle the results here
NSLog(@"user events: %@", result);
NSArray *feed =[result objectForKey:@"data"];
for (NSDictionary *dict in feed) {
NSLog(@"first %@",dict);
}
} else {
// An error occurred, we need to handle the error
// Check out our error handling guide: https://developers.facebook.com/docs/ios/errors/
NSLog(@"error %@", error.description);
}
}];