2013-01-22 28 views
1

我在ios中使用facebook圖形api來分享來自iphone的新聞動態。但我得到以下錯誤:ios中的facebook圖形api錯誤 - 未知路徑組件

{com.facebook.sdk:ParsedJSONResponseKey={ 
body =  { 
    error =   { 
     code = 2500; 
     message = "Unknown path components: /http://newswatch.nationalgeographic.com/2013/01/20/top-25-wild-bird-photographs-of-the-week-34; 
     type = OAuthException; 
    }; 
}; 
code = 400; 

}, com.facebook.sdk:HTTPStatusCode=400} 

以下是我的代碼上btnClick共享新聞推送部分:

if ([strType isEqualToString:@"link"]) { 


     text = [[resultArrFeed objectAtIndex:selectedIndex] objectForKey:@"caption"]; 
     if (text == nil) { 
      text = [[resultArrFeed objectAtIndex:selectedIndex] objectForKey:@"name"]; 
     } 
     if (text == nil) { 
      text = [[resultArrFeed objectAtIndex:selectedIndex] objectForKey:@"story"]; 
     } 
     NSDictionary *dict = [resultArrFeed objectAtIndex:selectedIndex]; 



     dic=[NSDictionary dictionaryWithObjectsAndKeys:text,@"message",nil]; 
     NSLog(@"%@", dict); 
     // NSString *str = [dict valueForKey:@"link"]; 
     NSString *str = [dict valueForKey:@"link"]; 
     request=[NSMutableString stringWithString: @"me/feed/"]; 
     [request appendString:str]; 
     NSLog(@"appended : %@", request); 
    } 

相同的代碼工作,如果我嘗試共享新聞複製的照片類型。我在哪裏錯了?我如何解決這個問題?

+0

您可以分享您在進行API調用的代碼嗎?一件很簡單的事情是,你可能想要考慮傳遞你的參數,例如:link,而不是將它附加到我/ feed端點。 –

回答

0

我得到了錯誤:正確的代碼:

如果([strType isEqualToString:// 「鏈接」] || [strType isEqualToString:@ 「視頻」]){

 text = [[resultArrFeed objectAtIndex:selectedIndex] objectForKey:@"caption"]; 
     if (text == nil) { 
      text = [[resultArrFeed objectAtIndex:selectedIndex] objectForKey:@"name"]; 
     } 
     if (text == nil) { 
      text = [[resultArrFeed objectAtIndex:selectedIndex] objectForKey:@"story"]; 
     } 
     NSDictionary *dict = [resultArrFeed objectAtIndex:selectedIndex]; 

     NSLog(@"%@", dict); 

     NSString *str = [dict valueForKey:@"link"]; 
     dic=[NSDictionary dictionaryWithObjectsAndKeys:str,@"link",nil]; 
     request=[NSMutableString stringWithString: @"me/feed/"]; 

     NSLog(@" %@", dic); 
    } 

在要求我們只需要通過我/飼料和FBRequest * friendRequest參數= [FBRequest requestWithGraphPath:請求參數:dic HTTPMethod:@「POST」];我們需要傳遞鏈接= http:// ...

相關問題