2010-09-15 61 views
2

也許有人不能幫助我。FBConnect iphone:我coud'nt獲取某些帳戶的照片相冊?

我使用最後一個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型動物測試佔所有隱私(帳戶/隱私設置)相同的規則。對於其中一些專輯列表是空的?如果我通過臺式計算機上的網頁瀏覽器(https://graph.facebook.com/me/albums)測試帳戶誰不工作在iphone上,列表不是空的?

在iPhone上,我使用圖形API或FQL具有相同的結果(「SELECT援助從相冊WHERE所有者=我()」)

也許我錯過了一些思考的配置關閉facebookapp?

感謝您的回答。

回答

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"]]; 

} 
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); 
          } 
}]; 
相關問題