My following code for posting the UIImage to user’s facebook wall is not working .I’ve looked into the sample code that comes along with the facebook sdk and its working fine. I am unable to find whats going wrong with my code.
-(void) shareOnFacebook
{
facebook = [[Facebook alloc] initWithAppId:@"MYAPPID" andDelegate:(id)self];
NSArray * neededPermissions = [[NSArray alloc] initWithObjects:@"offline_access",@"user_about_me", @"publish_stream", @"user_photos", nil] ;
[facebook authorize:neededPermissions ];
if (![facebook isSessionValid])
{
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
[facebook requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:(id)self];
}
}
please tell me that what can be the problems?
thanks in advance..
you need to call the upload function after the delegate method
- (void)fbDidLoginis being called .. try to do it like this and it should work