ASIHTTPRequest Disables Touch Events on Multiple Requests

40 views Asked by At

I have a problem with ASIHTTPRequest library. I have a lot of requests runs asynchronously. But somehow, one of the request blocks touch events on ui until it finishes. If i don't send this request, another request will cause this problem.

Also i have noticed that the request which causes problem, doesn't start when i run

[req startAsynchronously];

It starts with 15-30 seconds delay.

Do you have any idea why this happens? Here is an example of my request. All of them are look like that.

requestData = [[ASIHTTPRequest alloc] initWithURL:url]];
[requestData setUsername:@"username"];
[requestData setPassword:@"pass"];
[requestData setRequestKey:@"key"];
[requestData setRequestMethod:@"GET"];
[requestData setDelegate:self];
requestData.shouldAttemptPersistentConnection = NO;
[requestData startAsynchronous];
1

There are 1 answers

0
gikygik On

ASIHTTPREQUST is pretty obsolete and hasn't been updated since like 2012 unless you did the updating. Try using AFNetworking.

Since I haven't even looked at that library since around that time I don't know the exact issue, also since there are probably lots of issues now as it hasn't been updated (unless you did). Here are some suggestions that you could always try. Try adding your own blocks.

here is for async in the background (no UI) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ });

Here is you are manipulating UI and need to do it on the main thread

 dispatch_async(dispatch_get_main_queue(), ^{
    });