ios - AFHTTPSessionManager GET freezing/getting deadlocked? -


i ran problem 1 of our clients have slow internet connection , use groundcontrol. anytime try load app, stuck on "attemping connect server" loading screen. know in code must getting stuck here (see code below), because neither success or failure ever called (if app @ least advance).

nsurl *ourtable = [nsurl urlwithstring:[[nsstring stringwithformat: @"%@://%@%@/bla/%@/bla/bla/reachability", (usesslb == yes) ? @"https" : @"http", server, port, self.globalsettings.env]   stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]];  afhttpsessionmanager *manager = [afhttpsessionmanager manager]; manager.responseserializer    = [afjsonresponseserializer serializer];  [manager get:ourtable.absolutestring parameters:nil progress:nil success:^(nsurlsessiondatatask * _nonnull task, id  _nullable responseobject) {      nslog(@"online..");     [self.oursyncclass functionthatgetscalledwhensuccess;      [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(syncother) userinfo:nil repeats:no];     startsync = yes; //bool value used other stuffs      nslog(@"syncing data");     [manager invalidatesessioncancelingtasks:yes];  } failure:^(nsurlsessiondatatask * _nullable task, nserror * _nonnull error) {     nslog(@"failed connect server. %@", error);     self.offline = yes; //bool used other stuff     [uiview beginanimations:nil context:nil];     [uiview setanimationduration:1.0];     [self.homeviewcontrollerinstance.syncview setalpha:0.0];     [uiview commitanimations];      [self.oursyncclass createdb];     [self.oursyncclass opendb];      [self startcustomfunction;     [manager invalidatesessioncancelingtasks:yes];  }]; 

why our code stuck (locked?) in completion block? due slow internet connection? possibly have groundcontrol? how can handle type of situation?

well ended finding out problem. turns out had logical bug in our code object oursyncclass wasn't initialized every time before snippet of code executed. reason deadlocking completion block. so, included check if(self.oursyncclass != nil) {

} around code , seems working properly. i'll post update after response our client well.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -