How to catch response in custom function? Basically answer gets:
- (void)request:(FBRequest *) request didReceiveResponse:(NSURLResponse *)response{
NSLog(@"I have some information");
// [wait stopAnimating];
//wait.hidden;
}
- (void)request:(FBRequest *) request didLoad:(id)result{
if ([result isKindOfClass:[NSArray class]]){
result = [result objectAtIndex:0];
}
else{
// dictionaryWithNames = result;
infoStatus.text = [result objectForKey:@"name"];
infiId.text = [result objectForKey:@"id"];
}
if ([result objectForKey:@"data"]){
arrayWithFriends = [result objectForKey:@"data"];
if (arrayWithFriends != nil) {
for (NSDictionary *output in arrayWithFriends){
NSString *namaFriends = [output objectForKey:@"name"];
NSLog(@"Your Friend %@", namaFriends);
infoStatus.text = @"If you could see konsole... You can't";
continue;
}
} else {
infoStatus.text = @"You Haven't Got friends or Mutuals";
}
}
}
But i need to have another function because its impossible(or too hard) to get all responses that i need, using only few patterns in this function.
you can use same schema as facebook developers in their sample application here
https://github.com/facebook/wishlist-mobile-sample/blob/master/iOS/Wishlist/Wishlist/HomeViewController.m
they create currentAPIcall variable and fill it depending on request like that:
…