iOS:上传到 Facebook 的照片并不总是上传

发布于 2024-12-02 12:47:52 字数 1818 浏览 1 评论 0原文

我有一个 iPhone/iPad 应用程序,可以进行一些基本的照片编辑,并让用户可以选择将成品上传到 Facebook。该应用程序拥有超过 100,000 名用户,其中大多数用户将照片上传到 Facebook 似乎没有任何问题。然而,有少数用户似乎无法上传照片,无论他们如何尝试。我已与他们合作,以确保不是应用程序权限或 Facebook 设置阻止了他们,并且找不到任何问题。所以我想知道我是否对 FBConnect 做了一些错误的事情,导致问题偶尔出现。代码如下:

- (void)initFacebook {
  if( self.facebook == nil ) {
    Facebook *fb = [[Facebook alloc] init];
    self.facebook = fb;
    [fb release];
  }

  if( [self.facebook isSessionValid] ) { 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"FacebookIsReady"
                                                    object:nil
                                                  userInfo:nil];

  } else {
    NSArray *perms = [NSArray arrayWithObjects:@"publish_stream", @"user_likes", nil];
    [self.facebook authorize:MY_FB_APP_ID permissions:perms delegate:self];
  }
}

-(void)fbDidLogin {
    [[NSNotificationCenter defaultCenter] postNotificationName:@"FacebookIsReady"
                                                    object:nil
                                                  userInfo:nil];
}

// this is in a different class
- (void)facebookIsReady:(NSNotification *)notification {    
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:self.theImage, @"source", nil];

    [appDelegate.facebook requestWithGraphPath:@"/me/photos" 
                                         andParams:params 
                                     andHttpMethod:@"POST" 
                                       andDelegate:appDelegate];
}

在 FBRequestDelegate 中,即使照片未能出现在 Facebook 个人资料中,也始终会调用 didLoad。所以我的意思是,代码似乎永远不会失败,但照片并不总是出现在 Facebook 个人资料上。

该应用程序是否有可能无法在用户个人资料上创建新相册?我之前在各个小组中看到过其他人报告过这个问题,但从未找到实际的解决方案。谢谢。

I have an iPhone/iPad app that does some basic photo editing and gives the user the option to upload the finished product to Facebook. The app has more than 100,000 users and the majority seem to have no problem uploading their photos to Facebook. However, there are a handful of users that cannot seem to get their photos to upload no matter what they try. I have worked with them to ensure it is not app permissions or Facebook settings blocking them and cannot find any problem there. So I'm wondering if I am doing something incorrectly with FBConnect that is causing the problem to crop up once in a while. Here is the code:

- (void)initFacebook {
  if( self.facebook == nil ) {
    Facebook *fb = [[Facebook alloc] init];
    self.facebook = fb;
    [fb release];
  }

  if( [self.facebook isSessionValid] ) { 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"FacebookIsReady"
                                                    object:nil
                                                  userInfo:nil];

  } else {
    NSArray *perms = [NSArray arrayWithObjects:@"publish_stream", @"user_likes", nil];
    [self.facebook authorize:MY_FB_APP_ID permissions:perms delegate:self];
  }
}

-(void)fbDidLogin {
    [[NSNotificationCenter defaultCenter] postNotificationName:@"FacebookIsReady"
                                                    object:nil
                                                  userInfo:nil];
}

// this is in a different class
- (void)facebookIsReady:(NSNotification *)notification {    
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:self.theImage, @"source", nil];

    [appDelegate.facebook requestWithGraphPath:@"/me/photos" 
                                         andParams:params 
                                     andHttpMethod:@"POST" 
                                       andDelegate:appDelegate];
}

In the FBRequestDelegate the didLoad is always called even when the photo fails to appear in the Facebook profile. So what I'm getting at is the code never seems to fail but the photo doesn't always appear on the Facebook profile.

Is it possible that the app is not able to create a new album on the users profile? I have seen others report this problem before on various groups but have never found an actual solution. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小霸王臭丫头 2024-12-09 12:47:52

您必须在权限数组中包含 user_photos ,如下所示:

NSArray *permissions = [[NSArray alloc] initWithObjects:
    @"user_photos",
    @"publish_stream",
    @"user_likes",
     nil];

这是所有权限的列表:https://developers.facebook.com/docs/reference/api/permissions/

You have to include user_photos in your permissions array like this:

NSArray *permissions = [[NSArray alloc] initWithObjects:
    @"user_photos",
    @"publish_stream",
    @"user_likes",
     nil];

Here is the list of all the permissions: https://developers.facebook.com/docs/reference/api/permissions/

谜兔 2024-12-09 12:47:52
  • 通过社交框架在 Facebook 上上传照片要容易得多。
  • 请检查以下链接
    Fabecook 分享
  • Uploading Photo on Facebook vie Social Framework is much easier .
  • Pleae check the below link
    Fabecook Sharing
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文