I have a ViewController with so many information and, to better read the code, I split parts of this VC in two Views. So, I initialize these Views, set frames and add them as subviews to the ViewController.
These Views have a .xib connected and I’m able to link to all my IBOutlets. Until here, all ok but..
..in one of these Views I need to query Facebook, to retrieve some information. So I use the code:
[FBRequestConnection startWithGraphPath:@"myGraphApiQuery"
parameters:nil
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
[myOutlet setTitle:@"Test"]; // here's the issue
}];
With this code myOutlet never will be set with Test title, seems the outlet’s not linked. I don’t understand why I’m not able to link to my outlet from block code completionHandler of FBRequestConnection…
If I try to set the Title from a selector called from ViewController, it’s all ok..
Can someone explain me the reason of it? I’m still a objective-c beginner.
The callback from
FBRequestConnectionis invoked on a background thread. UIKit calls must be made on the main thread. Try this: