iOS: Photo uploaded to Facebook does not always upload
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.
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/
- Uploading Photo on Facebook vie Social Framework is much easier .
- Pleae check the below link Fabecook Sharing
精彩评论