Tuesday, 15 September 2015

ios - Check if the current request is already in request queue using restkit iphone -



ios - Check if the current request is already in request queue using restkit iphone -

i using restkit sending request, response mapping , all. sometimes, sending same request multiple time comes different screens. added request queue. don't want add together request request queue if request there. how can check that.

i calling function this

//here need check if next url in rkrequestqueue. if not there phone call below method,

[self getdatafromserver]; - (void)getdatafromserver{ rkobjectmanager *manager = [[restkit shareddatamanager] objectmanager]; [manager loadobjectsatresourcepath:@"/getdata" usingblock:^(rkobjectloader *loader) { [rkclient sharedclient].requestqueue.showsnetworkactivityindicatorwhenbusy = yes; loader.method = rkrequestmethodpost; loader.params = inputdata; loader.ondidfailwitherror = ^(nserror *error) { }; loader.ondidloadobjects = ^(nsarray *objects) { }; }

any help appreciated.

interesting question, pretty sure can check urls of requests in rkrequestqueue, wasn't able find useful in rkrequestqueue reference. instead, i've found containsrequest: method, compare rkrequest objects, not actual urls.

i guess simplest thing create kind of proxy managing network activity, implement requestqueue:didsendrequest: delegate method , monitor urls processed.

iphone ios objective-c xcode restkit

No comments:

Post a Comment