LoginSignup
8
8

More than 5 years have passed since last update.

自分のWallに投稿するロジック

Posted at

※Facebook SDK Ver3.1になって、参照・書込の権限が分離されているので、書き込む場合は別途権限を取得する必要がある。

    if(FBSession.activeSession.isOpen){

        if([FBSession.activeSession.permissions indexOfObject:@"publish_stream"] == NSNotFound){
            [FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObjects:@"publish_stream", nil] defaultAudience:FBSessionDefaultAudienceFriends completionHandler:^(FBSession* session, NSError* error){
            }];
        }

        NSMutableDictionary* paramDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
                                          @"This is test column", @"message", nil];
        [FBRequestConnection startWithGraphPath:@"me/feed" parameters:paramDict HTTPMethod:@"POST"
                              completionHandler:^(FBRequestConnection* connection, id result, NSError* error){
            DLog(@"error : %@", error);
            DLog(@"result : %@", result);
        }];
    }
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8