0

I want to know how we can auto refresh a uitableview by using polling. I have a table which contains messages users sent. So when I load the view i use AFTNetworking to get the JSOn response and display it in the uitableview. Now if the user stays on the screen and we get a new message posted it should automatically refresh the uitableview.So far what I can do it to call the url at certain time intervals. Any solutions to that?

veereev
  • 2,650
  • 4
  • 27
  • 40
  • add refresh button in navigation bar and when user click on that send request after getting response add this line to refresh tableview [yrtableview reloadData]; – Sugan S Mar 25 '13 at 08:34

1 Answers1

0

Following Timer will invoke "loadNewData" after each 10 seconds

NSTimer *refreshTimer = [NSTimer scheduledTimerWithTimeInterval:10.0f target:self selector:@selector(loadNewData) userInfo:nil repeats:YES];

write your loading code in this method

-(void)loadNewData
{
    // write code to fetch Data from Server
}
Dipen Panchasara
  • 13,480
  • 5
  • 47
  • 57
  • Hi there thanks for your response wi ill try that and get back to you :) – veereev Mar 25 '13 at 09:05
  • i think this is wrong. Technically it will work but think about it, when tons of devices fetch requests from your server at a one time, what will happen ?, either i'm looking for solution for this also i did a some research at the end i stopped at node.js tcp/ip network programming, but i've no luck and finding solution over and over again ..... – Соёмбо Бат-Эрдэнэ Sep 20 '13 at 13:12