- Use threading to wait for another class's method to execute, or is there a simpler way?
- [facebook requestWithMethodName:@"fql.query" andParams:dictionary andHttpMethod:@"GET" andDelegate:self];
- - (void)requestLoading:(FBRequest *)request {
- NSLog(@"Loading...");
- }
- - (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response {
- NSLog(@"Response received");
- }
- - (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
- NSLog(@"Request failed");
- }
- - (void)request:(FBRequest *)request didLoadRawResponse:(NSData *)data {
- NSLog(@"Request did load raw response");
- }
- - (IBAction)friendsButtonPressed:(id)sender {
- int selectionTag = [sender tag];
- //Get access to the instance of the wrapper in the app delegate (since it needs to remain refereced after app exits to log in and returns
- MiniBfAppDelegate *appDelegate = (MiniBfAppDelegate *)[[UIApplication sharedApplication] delegate];
- [appDelegate.facebookWrapper loadListDataFor:selectionTag];
- //Initialise the friends view controller
- FriendsViewController *friendsViewController = [[FriendsViewController alloc] init];
- //NEED TO WAIT UNTIL LISTDATA IS RETURNED?
- //Give the friends view controller the list data
- friendsViewController.listData = appDelegate.facebookWrapper.friendsList;
- //Push the friends view controller
- friendsViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
- [self.navigationController pushViewController:friendsViewController animated:YES];
- [friendsViewController release];
- }
- [[NSNotificationCenter defaultCenter] postNotificationName:@"myNotificationName"
- object:self
- userInfo:[NSDictionary dictionaryWithObject:XXXX forKey:@"someObject"]];
- [[NSNotificationCenter defaultCenter] addObserver: self
- selector: @selector(yourMethodHere:)
- name: @"myNotificationName"
- object: nil];
- - (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response {
- NSLog(@"Response received");
- //Give the friends view controller the list data
- friendsViewController.listData = appDelegate.facebookWrapper.friendsList;
- //Push the friends view controller
- friendsViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
- [self.navigationController pushViewController:friendsViewController animated:YES];
- [friendsViewController release];
- }