title: iOS Facebook SDK Error Domain com.facebook.sdk Code 2 and Code 7
body: <p>I am developing the application which allow user to login via Facebook (using Facebook SDK for it). The error appears when a user has already logged in Facebook in iPhone settings. If not - all work correctly. </p>
  
  <pre><code>NSArray *permissions = [[NSArray alloc] initWithObjects:@"email", nil];
      [FBSession openActiveSessionWithReadPermissions:permissions
                                         allowLoginUI:YES
                                    completionHandler:
       ^(FBSession *session,
         FBSessionState state, NSError *error) {
           [self fbSessionStateChanged:session state:state error:error];
       }];
  </code></pre>
  
  <p>I've already tried to set permissions as nil array - nothing changed. </p>
  
  <h2>The log is:</h2>
  
  <pre><code>Error Domain=com.facebook.sdk Code=2 "The operation couldn’t be completed.
  (com.facebook.sdk error 2.)" UserInfo=0x1552c6c0 
  {com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginDisallowedWithoutError,
  com.facebook.sdk:ErrorSessionKey=&lt;FBSession: 0xabe8100, state: FBSessionStateClosedLoginFailed,
  loginHandler: 0x0, appID: APPIDHERE, urlSchemeSuffix: ,
  tokenCachingStrategy:&lt;FBSessionTokenCachingStrategy: 0x14b8f3d0&gt;,
  expirationDate: (null), refreshDate: (null),
  attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)&gt;}
  </code></pre>
  
  <p>Sometimes the error with Code 7 is appears too. <strong>I have read almost all topics related to this error.</strong> </p>
  
  <p>My steps were: </p>
  
  <ol>
  <li><strong>Compare my app id in .plist file with FB bundle id. They are the same!!!</strong></li>
  <li><strong>My app is not in a sandbox mode!</strong></li>
  <li>If I change from <code>[FBSession openActiveSessionWithReadPermissions:permissions</code> to  <code>[FBSession openActiveSessionWithPermissions:permissions</code>- it works. But it is deprecated. </li>
  </ol>