ios - svprogresshud not showing on main thread -
on viewdidload of tableviewcontroller have following
[svprogresshud showwithstatus:@"loading"]; [self getdata]; [svprogresshud dismiss]; on getdata method, using afnetworking data backend api. since asynchronous call, expect svprogresshud show.
-(void) getdata { afhttprequestoperationmanager * reqmanager =afhttprequestoperationmanager manager]; afhttprequestserializer *serializer = [afhttprequestserializer serializer]; //set auth token..etc [reqmanager get:urlstring parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { //code success.... } failure:^(afhttprequestoperation *operation, nserror *error) { //code failure }]; } but it's not showing @ all. working on main thread. going wrong ?
the problem showing hud after method call like
[self getdata]; [svprogresshud dismiss]; this problem. move dismiss code to
-(void) getdata { afhttprequestoperationmanager * reqmanager =afhttprequestoperationmanager manager]; afhttprequestserializer *serializer = [afhttprequestserializer serializer]; //set auth token..etc [reqmanager get:urlstring parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { //code success.... [svprogresshud dismiss]; } failure:^(afhttprequestoperation *operation, nserror *error) { //code failure [svprogresshud dismiss]; }]; } you can see dismiss call in success , failure of webservice call, , call getdata method by
[svprogresshud showwithstatus:@"loading"]; [self getdata]; remove [svprogresshud dismiss] here.
Comments
Post a Comment