Two connections firing for each request


#1

I seem to be having a problem where two connections are firing for each request made. I found the following information when I engaged Xcode’s debugger to review.

(1) added breakpoints to various connection/datastore class methods just to understand lifecycle of request/connection
(2) add up frame after each call to fetchJSONData:withCompletion:
(3) Noted that the internalConnection causes one connection to fire immediately

I am unsure why (3) is needed or it’s role in the connection/request lifecycle.

I’d like to reduce the overhead associated with firing two connections for a single request. Could any supply a pointer as to what I am missing???

1:-initWithRequest: 1:-start 1:-fetchJSONData:withCompletion: frame #1: 0x0010df34 318 319 //initiate the request with offset position of zero 320 // -> 321 [[BNRDataStore sharedStore] fetchJSONData:0 withCompletion:completionBlock]; 322 323 [[self view]removeFromSuperview]; 324 } 2:-fetchJSONData:withCompletion: frame #1: 0x0010df34 318 319 //initiate the request with offset position of zero 320 // -> 321 [[BNRDataStore sharedStore] fetchJSONData:0 withCompletion:completionBlock]; 322 323 [[self view]removeFromSuperview]; 324 } 1:-connection:didReceiveData: 2:-connection:didReceiveData: 1:-connectionDidFinishLoading:

The two connections appear to fire from the following related code:

BNRDataStore fetchJSONData:withCompletion:

//create connection to transfer data from the server
BNRConnection *connection = [[BNRConnection alloc] initWithRequest:req];

And in [connection start]…