title: Facebook SDK 4.0: Asking publish_actions
body: <p>I am using <strong>FBSDKLoginButton</strong> for logging in through <strong>Facebook</strong> in my App. Well I define the <strong>readPermissions</strong> as;</p>
  
  <pre><code>NSArray *permissions = [NSArray arrayWithObjects:@"public_profile", @"email",nil];
  self.loginFbBtn.readPermissions = permissions;
  </code></pre>
  
  <p>The above goes all well. But now if I need to ask permissions for a post to my timeline and want to have access to "<strong>publish_actions</strong>" permissions, is there a way to ask these without actually provoking <strong>FBSDKLoginManager</strong>, because that is the only way given in <a href="https://developers.facebook.com/docs/facebook-login/ios/permissions" rel="nofollow">Facebook docs</a>:</p>
  
  <pre><code>if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) {
    // TODO: publish content.
  } else {
    FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
    [loginManager logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
      //TODO: process error or result.
    }];
  }
  </code></pre>
  
  <p>Apparently this is the only way you can invoke "<strong>publish_actions</strong>" for your app. I want to use it without the <strong>FBSDKLoginManager</strong>. Please help, I need to get this rolling.</p>
  
  <p><strong>SO THIS IS THE UPDATE:</strong></p>
  
  <p>By the help of <em>Wizkid</em> and <em>MingLi</em> I ended up implementing it via <strong>FBSDKLoginManager</strong> and the following code segments are for Facebook Login via a custom button and its <code>@selector(facebookLogin)</code>, and then sharing permissions invoked when sharing is required via method <code>getSharingPermissions</code> :</p>
  
  <pre><code>-(void) facebookLogin
  {
      @try
      {
          self.loginManager = [[FBSDKLoginManager alloc] init];
          [self.loginManager setLoginBehavior:FBSDKLoginBehaviorWeb];
          [self.loginManager logInWithReadPermissions:@[@"public_profile",@"email"] handler:^(FBSDKLoginManagerLoginResult *result,NSError *error)
          {
              if([FBSDKAccessToken currentAccessToken])
              {
                  [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
                   startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error)
                   {
                       if (!error)
                       {
                           NSLog(@"fetched user:%@", result);
                           NSDictionary *userDict = (NSDictionary*)result;
                       }
                   }];
              }}];
      }
  }
  @catch (NSException *exception)
  {
      NSLog(@"Exception %@", exception);
  }
  </code></pre>
  
  <p>Get Sharing Permissions:</p>
  
  <pre><code>-(void)getSharePermissions
  {
      if (![[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"])
      {
          [self.loginManager setLoginBehavior:FBSDKLoginBehaviorWeb];
          [self.loginManager logInWithPublishPermissions:@[@"publish_actions"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
          {
              if ([result.grantedPermissions containsObject:@"publish_actions"])
              {
  
              }}];
      }
  }
  </code></pre>
  
  <p>So the error is I am getting the Login page again and is asking User Credentials again when <code>getSharingPermissions</code> is called. Please help. Thanks in advance.  </p>