6

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.

Alex
  • 101
  • 1
  • 4

2 Answers2

0
  • Uploading Photo on Facebook vie Social Framework is much easier .
  • Pleae check the below link Fabecook Sharing
Jayaprada
  • 944
  • 8
  • 11
0

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/

Javier Beltrán
  • 756
  • 5
  • 26
  • To add to this: without `user_photos`, if the photo is uploaded successful, ask the user to manually navigate in to their photo albums and poke around a bit. If it is indeed working, they will probably encounter a UI that tells them that they have pending uploads that they need to approve manually. The dialog is very understated, so it's easy to miss. (Also, for what it's worth there is probably also a manual privacy setting that users can toggle to enforce this behavior even with the `user_photos` permission included - just guessing.) – toblerpwn Dec 25 '12 at 09:08