ios - Tableview reload data not working when using afnetworking 2? -
this question exact duplicate of:
afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; manager.requestserializer = [afjsonrequestserializer serializer]; manager.responseserializer.acceptablecontenttypes = [nsset setwithobject:@"text/html"]; [manager get:[nsstring stringwithformat:@"%@%@",tic_url,@"list_messages.php"] parameters:params success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"responseobject %@",responseobject); if (![[responseobject valueforkey:@"status"] isequaltostring:@"0"]) { marrchat = [responseobject valueforkey:@"data"]; [self.tblchat reloaddata]; if (marrchat.count > 0) { [self.tblchat scrolltorowatindexpath:[nsindexpath indexpathforrow:marrchat.count-1 insection:0] atscrollposition:uitableviewscrollpositionbottom animated:yes]; } } failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@"error %@",error); [commonfunctions shownonetworkerror]; hidehud; }];
write [self.tblchat reloaddata];
in main queue.
dispatch_sync(dispatch_get_main_queue(), ^{ [self.tblchat reloaddata]; });
Comments
Post a Comment