facebook图api in ios error

系统教程 行业动态 更新时间:2024-06-14 16:53:07
facebook图api in ios error-未知路径组件(facebook graph api in ios error- Unknown path components)

我在ios中使用facebook graph 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); }

如果我尝试共享照片类型的新闻源,相同的代码可以正常工作。 我哪里错了? 我该如何解决这个问题?

i am using facebook graph api in ios to share a news feed from iphone. But i get the following error:

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

following is part of my code to share a newsfeed on 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); }

same code works if i try to share a photo type of newsfeed. where am i getting wrong? how do i solve this problem?

最满意答案

我收到了错误:正确的代码:

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

在请求中我们只需要传递给我/ feed和FBRequest的params * friendRequest = [FBRequest requestWithGraphPath:request parameters:dic HTTPMethod:@“POST”]; 我们需要传递link = http:// ...

i got the error: correct code:

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

in request we only need to pass me/feed and in params of FBRequest *friendRequest = [FBRequest requestWithGraphPath:request parameters:dic HTTPMethod:@"POST"]; we need to pass link=http://...

更多推荐

本文发布于:2023-04-05 21:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/21942e7ba8f21c8940037be0c92e4e59.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:api   facebook   error   ios

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!