我刚开始使用 Graph API 并让它登录,但不进行图形 api 调用。我已经设置了委托(我认为),但它没有回调我实现的委托方法。这是我的代码:
#import <UIKit/UIKit.h>
#import "Profile.h"
#import "AppDelegate.h"
#import "FBRequest.h"
@interface HomeViewController : UITableViewController <FBRequestDelegate>
{
Profile *profile;
AppDelegate *appDelegate;
}
- (void)request:(FBRequest *)request didLoad:(id)result;
@end
执行:
- (void)viewDidLoad
{
[super viewDidLoad];
profile = [[Profile alloc] initWithUserId:1];
[profile refreshMatchesWithCallback:^
{
[self.tableView reloadData];
}];
[appDelegate.facebook requestWithGraphPath:[NSString stringWithFormat: @"me", appDelegate.facebook.accessToken] andDelegate:self];
[[appDelegate facebook] requestWithGraphPath:@"me" andDelegate:self];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)request:(FBRequest *)request didLoad:(id)result {
NSLog(@"%@", result);
}
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
NSLog(@"erre");
}