【问题标题】:How can i hide the url of image when i post image on the Facebook by fbconnect?当我通过 fbconnect 在 Facebook 上发布图片时,如何隐藏图片的网址?
【发布时间】:2012-11-05 10:08:08
【问题描述】:

我正在使用此代码在 facebook 上发布图像,但它也在 facebook 上显示图像 url。我想隐藏这个网址:

这是我将图片发布到 facebook 的代码

#pragma mark Facebook 

-(void)facebook
{
    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
        @"I'm using Shape App", @"message",  @"I'm using Shape App", @"caption",
        @"http://www.imageurlhost.com/images/3kft472rvl2qtnzx11_Sample.png", @"picture",
        @"I'm using Shape App", @"title",nil];
    [[delegate facebook] dialog:@"feed" andParams:params andDelegate:self];
  }

请看下面的图片

【问题讨论】:

  • 您是否尝试过在source 参数中包含图像数据本身,而不是在picture 中包含指向它的URL?
  • 是的,我也试过这个,但它在我的代码中工作
  • 什么是 image1?是NSData吗?你试过用file 作为参数名吗?
  • 我已经尝试将源作为数据或图像两者

标签: iphone facebook ios5


【解决方案1】:

您所做的是发布一个 URL,因此它显示为:您共享的 链接。此链接是否指向图像而不是网站并不重要。

您可以更改的选项是,

a) 改为发布包含图像的 Open Graph 页面的链接 - 然后您可以设置将显示该共享链接的标题和描述,或者

b) 将其作为真实照片发布,https://developers.facebook.com/docs/reference/api/user/#photos

【讨论】:

    【解决方案2】:

    我已经通过最新的 ios6 facebook 集成解决了: 为此,您必须导入 Social.framework,然后将此代码放入您要调用 Facebook 的方法中。但它仅适用于 iOS 6 及更高版本

           NSData *imageData=[NSData dataWithContentsOfURL:[NSURL urlWithString:@"http://www.imageurlhost.com/images/3kft472rvl2qtnzx11_Sample.png"]];
     if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
    
       {
        mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"I am using Shape App"]];
        [mySLComposerSheet addImage:[UIImage imageWithData:imageData]];
        [self presentViewController:mySLComposerSheet animated:YES completion:nil];
       }
    
      else
    
       {
        UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@"No Facebook Account" message:@"There are no Facebook accounts configured.You can add or create a Facebook account in Settings" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
        [alertView show];
    }
    [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result)
     {
       // NSLog(@"dfsdf");
    
        switch (result) {
            case SLComposeViewControllerResultCancelled:
    
                break;
            case SLComposeViewControllerResultDone:
    
                break;
            default:
                break;
        }
    
    }];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多