1

iOS で Facebook グラフ API を使用して、iPhone からニュース フィードを共有しています。しかし、次のエラーが表示されます。

 {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);
    }

写真タイプのニュースフィードを共有しようとすると、同じコードが機能します。どこで間違っていますか?この問題を解決するにはどうすればよいですか?

4

1 に答える 1

0

エラーが発生しました: 正しいコード:

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

        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);
    }

リクエストでは、me/feed と FBRequest のパラメーターを渡すだけで済みます *friendRequest = [FBRequest requestWithGraphPath:request parameters:dic HTTPMethod:@"POST"]; link=http://... を渡す必要があります。

于 2013-01-23T05:37:41.017 に答える