2014-03-28 79 views
0
[FBRequestConnection startWithGraphPath:@"/me/scores" 
          parameters:nil 
          HTTPMethod:@"GET" 
         completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 
          if(result && !error) { 
           id x = [result objectForKey:@"data"]; 

           if(x) { 
            id y = [x objectForKey:@"score"]; 
           } 
          } 
        }]; 

只要它碰到「id y = [']」行,應用程序就會跳過它並假裝它從未執行過該行。當我轉到圖形瀏覽器工具時,我可以看到我的分數。Facebook分數返回零的API(iOS)

我請求以下權限:

permissions:(
installed, 
"user_games_activity", 
"basic_info", 
email, 
"public_profile", 
"user_friends" 
) 

我缺少權限?

謝謝!

回答

0

它拋出一個例外,因爲你錯過了一點。由於它在一個區塊中,除非您用調試器逐步完成,否則很容易錯過:

id x = [result objectForKey:@"data"]; 
id y = [x objectAtIndex:0]; // This bit! 
int score = [[y objectForKey:@"score"] intValue];