I am using ASIHTTPRequest to interact with my website. I am basically adding ASIHttpRequests to a queue. It all works fine if there is an internet connection. However, I guess the operation gets deleted if the request fails (ie, no internet connection)
Is there a way to queue and execute the request only when there's internet connection? If there's no internet connection, the request should be queued and automatically sent when the connection returns. If this is not possible, what is the best way to accomplish what I am trying here?
Thanks!
This is how I am setting up the queue right now :
NSURL *url = [NSURL URLWithString:@"http://www.tst.com.au/test.php?op=updateField"];
ASIFormDataRequest *startHourRequest = [ASIFormDataRequest requestWithURL:url];
NSDateFormatter *apiformatter = [[ [NSDateFormatter alloc] init] autorelease];
[apiformatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *webdate = [apiformatter stringFromDate:date];
[startHourRequest setDelegate:appDelegate];
[startHourRequest setPostValue:webdate forKey:@"fieldvalue"];
[startHourRequest setPostValue:[appDelegate shiftuid] forKey:@"uid"];
[startHourRequest setPostValue:editAttribute forKey:@"fieldname"];
[startHourRequest setDidFinishSelector:@selector(requestDone:)];
[startHourRequest setDidFailSelector:@selector(requestWentWrong:)];
[[appDelegate queue] addOperation:startHourRequest];