Im getting Facebook User Data to auto completing signup textfields.
Problem: I did a test and NSLog returns information quickly, but to update the TextFields.text it\'s
You need to perform UI updates on the main thread. Your completion handler is being called on a background thread.
[meRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (!error) {
NSDictionary *resultsDictionary = [responseData objectFromJSONData];
NSLog(@"%@", [resultsDictionary objectForKey:@"name"]);
// The problem is here. While NSLog runs in seconds showing Facebook User Name, the textfiend.text updates take about 10 seconds longer.
// Ensure UI updated on main queue
dispatch_async(dispatch_get_main_queue(), ^{
_tfName.text = [resultsDictionary objectForKey:@"name"];
_tfEmail.text = [resultsDictionary objectForKey:@"email"];
_tfGender.text = [resultsDictionary objectForKey:@"gender"];
_tfBirthday.text = [resultsDictionary objectForKey:@"birthday"];
});
}
}];