English 中文(简体)
如何在没有显示辩证的情况下张贴到Face?
原标题:How to post to Facebook without showing dialog?

我正在申请读者,可以向Facebook发送文字。 但我在另一页完成了对Facebook的标识。 我有一个叫做textpostingbt和一份载有案文的案文概览。 我需要做的是,当用户利用 but子把案文张贴到Facebook时,却不展示 log。 我在纽伦有了一些验证,因此,只有用户在

EDIT:

- (IBAction)postGradesTapped:(id)sender {
    //_posting = YES;
    // If we re not logged in, log in first...
    if (![_session isConnected]) {
        self.loginDialog = nil;
        _loginDialog = [[FBLoginDialog alloc] init];    
        [_loginDialog show];

        _logoutButton.hidden = YES;
    }
    // If we have a session and a name, post to the wall!
    //else if (_facebookName != nil) {
    //[self postToWall];
    //}
    // Otherwise, we don t have a name yet, just wait for that to come through.

}

- (IBAction)logoutButtonTapped:(id)sender {
    [_session logout];
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"FB_logged"];
    _btnFacebookmain.enabled =NO;
}


#pragma mark FBSessionDelegate methods

- (void)session:(FBSession*)session didLogin:(FBUID)uid {
    [self getFacebookName];

}

- (void)session:(FBSession*)session willLogout:(FBUID)uid {
    _logoutButton.hidden = YES;
    _facebookName = nil;
}

#pragma mark Get Facebook Name Helper

- (void)getFacebookName {
    NSString* fql = [NSString stringWithFormat:
                     @"select uid,name from user where uid == %lld", _session.uid];
    NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];
    [[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];
}

#pragma mark FBRequestDelegate methods

- (void)request:(FBRequest*)request didLoad:(id)result {
    if ([request.method isEqualToString:@"facebook.fql.query"]) {
        NSArray* users = result;
        NSDictionary* user = [users objectAtIndex:0];
        NSString* name = [user objectForKey:@"name"];
        self.facebookName = name;       
        _logoutButton.hidden = NO;
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"FB_logged"];
        [_logoutButton setTitle:[NSString stringWithFormat:@"Facebook: Logout as %@", name] forState:UIControlStateNormal];
        /*if (_posting) {
         [self postToWall];
         _posting = NO;
         }*/
    }
}
最佳回答
问题回答

follow this tutorial: https://developers.facebook.com/docs/mobile/ios/build/ IF you ll do this as they say, your FB connection will be global for your application. using appDelegate you will can post, read and do whatever you whant from any view controller in your app

在这里,你可以使用图表,即:https://github.com/reallylongaddress/iPhone-Facebook-Graph-API





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签