UIImageView + AFNetworking image request queue blocks other network requests from RestKit

I load data using RestKit, creating RKObjectRequestOperationand adding it to the RestKit queue:

RKObjectRequestOperation *operation = [RK objectRequestOperationWithRequest:request
       success:...
       failure:...];
[RK enqueueObjectRequestOperation:operation];

It works well. In addition, this data is displayed in a list view that contains UIImageViews displaying the corresponding user icons. These custom icons, however, are not loaded via RestKit, but through the AFNetworking core library. UIImageView + AFNetworking does the job just as well (including caching):

[self setImageWithURLRequest:userIconRequest
            placeholderImage:anonymousUser
                     success:nil
                     failure:...];

The problem is that these 15 custom icon requests from image views block the processing of the RestKit request, which should immediately load the next page. I see a list showing the "loading" line, as well as the first user icons. The moment the last image has finished loading, the next page adds itself.

A look at the implementation of UIImageView + AFNetworking shows that it uses its own instance of the NSOperation queue, which serializes requests. However, this should not interfere with RestKit, I suppose.

Also, adding NSOperationQueuePriorityto all queries does not change anything. Maybe internally, network requests are serialized differently? How to prioritize these requests?

Thanks in advance.

+5
1

NSURLConnection .

, UIImageView+AFNetworking NSOperationQueueDefaultMaxConcurrentOperationCount , , , AFNetworking .

. :

  • UIImageView+AFNetworking, , , 4 .
  • UIImageView+AFNetworking, , RestKit, .
0

All Articles