I'm developing an app that post a state on Facebook but I receive this error: the operation couldn’t be completed (com.facebook.sdk error 2) although I have pressed OK when asked if it could publish on Facebook a post. on iPhone settings I have already reset privacy and location, and though I give permission to publish I cannot find my app listed under "privacy" -> "Facebook"
here is my code to get permissions:
-(void)postOnFacebook
{
if (FBSession.activeSession.isOpen)
    [self postOnWall];
else
{
    [FBSession openActiveSessionWithPublishPermissions:[NSArray arrayWithObjects:@"publish_actions", nil]
                                       defaultAudience:FBSessionDefaultAudienceEveryone
                                          allowLoginUI:YES
                                     completionHandler:^(FBSession *session,
                                                         FBSessionState status,
                                                         NSError *error)
     {
         if (error)
         {
             UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                             message:error.localizedDescription
                                                            delegate:nil
                                                   cancelButtonTitle:@"OK"
                                                   otherButtonTitles:nil];
             [alert show];
         }
         else if (FB_ISSESSIONOPENWITHSTATE(status))
         {
             NSLog(@"Sending post on wall request...");
             [self postOnWall];
         }
     }];
};
}