I have a scene with json gets a facebook likes. I need automatic update for that scene (the screen must reload). when new data (in this case - facebook likes counts has been changed). I tried all samples over the web, but couldn't implement that.
ViewController.m:
AFHTTPRequestOperationManager *FaceBookLikes = [AFHTTPRequestOperationManager manager];
NSString *FBlikes = [[NSUserDefaults standardUserDefaults] objectForKey:@"faceBookUrlField"];
NSString *FBLstr = [NSString stringWithFormat:@"http://graph.facebook.com/%@", FBlikes];
[FaceBookLikes GET:FBLstr parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
self.posts = (NSDictionary *) responseObject;
self.post = self.posts [@"likes"];
NSLog(@"FB LIKES: %@", self.post);
labelFacebookLikesCount.text = [NSString stringWithFormat:@"%@", self.post];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
I will welcome any solving:
- update (refresh screen) when json counts has changed.
- update by time (for example) each 30 seconds.