i have integerated facebook sdk latest, i create App on developer with my acoount ABC ....and use Facebook App id . All is fine if i loging in my Ios app with my ABC account to loging with facebook.it post on my wall successfully .
But if i use any other Account to loging with facebook . i loged in successfully but when i post i got error .
**I am getting this erro**r
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x22689930 {com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={ body = { error = { code = 200; message = "(#200) The user hasn't authorized the application to perform this action"; type = OAuthException; }; }; code = 403; }, com.facebook.sdk:ErrorSessionKey=, expirationDate: 2014-08-15 08:56:01 +0000, refreshDate: 2014-06-16 10:10:43 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:( status, permission )>}
For Posting
-(void) post:(NSString *)postString {
if (FBSession.activeSession.state == FBSessionStateOpen|| FBSession.activeSession.state == FBSessionStateOpenTokenExtended)
{
NSArray *permissionsNeeded = @[@"publish_stream"];
[FBRequestConnection startWithGraphPath:@"/me/permissions"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error){
NSDictionary *currentPermissions= [(NSArray *)[result data] objectAtIndex:0];
NSMutableArray *requestPermissions = [[NSMutableArray alloc] initWithArray:@[]];
for (NSString *permission in permissionsNeeded){
if (![currentPermissions objectForKey:permission]){
[requestPermissions addObject:permission];
}
}
if ([requestPermissions count] < 1){
[FBSession.activeSession requestNewPublishPermissions:requestPermissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
if (!error) {
[self makeRequestToUpdateStatus:postString];
} else {
NSLog(@"%@",[error description]);
}
}];
} else {
[self makeRequestToUpdateStatus:postString];
}
} else {
NSLog(@"%@",[error description]);
}
}];
}
else
{
}
}
For Login
-(void)loginToFacebook { NSLog(@"the facebook login called "); if (!(FBSession.activeSession.state == FBSessionStateOpen || FBSession.activeSession.state == FBSessionStateOpenTokenExtended)){ NSArray *permissions = [[NSArray alloc] initWithObjects: @"publish_stream", nil];
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
dispatch_async( dispatch_get_main_queue(), ^{
[self sessionStateChanged:session
state:status
error:error];
});
}];
}
else { }
}