KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying out adding facebook integration in an app using the new (beta) facebook ios sdk 3.0. All I would like to is post a status update to facebook. I used a FBLoginView to login to facebook. I put my app id in the plist as instructed on facebook. I put in some code to post to facebook. (void)viewDidLoad { [super viewDidLoad]; NSArray *perms; perms = [NSArray arrayWithObjects:@"status_update", nil]; FBLoginView *loginview = [[FBLoginView alloc] initWithPermissions:perms]; loginview.frame = CGRectOffset(loginview.frame, 5, 5); loginview.delegate = self; [self.view addSubview:loginview]; // Do any additional setup after loading the view, typically from a nib. } - (IBAction)poststatus:(UIButton *)sender { NSString *message = [NSString stringWithFormat:@"Test staus update"]; [FBRequestConnection startForPostStatusUpdate:message completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { [self showAlert:message result:result error:error]; }]; } - (void)showAlert:(NSString *)message result:(id)result error:(NSError *)error { NSString *alertMsg; NSString *alertTitle; if (error) { alertMsg = error.localizedDescription; alertTitle = @"Error"; } else { NSDictionary *resultDict = (NSDictionary *)result; alertMsg = [NSString stringWithFormat:@"Successfully posted '%@'.\nPost ID: %@", message, [resultDict valueForKey:@"id"]]; alertTitle = @"Success"; } UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle message:alertMsg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } The odd thing is, this code works ONCE. After authenticating the use
Tags (comma-separated)
Save Edits
Cancel