uitableview - 3 Requests per object with AFIncrementalStore using NSFetchedResultsController -


i have setup afincrementalstore use parse backend service. using such service makes counting api requests important if exceed 1mm requests/month (though successful metric!) result in decent bills. wouldn't issue, i'm seeing, if put breakpoint @ following method in afhttpclient:

- (void)enqueuehttprequestoperation:(afhttprequestoperation *)operation; 

i find requests particular object occurs 3 times, when need once.

$1 = 0x0b9afe30 https://api.parse.com/1/classes/poem/cuptflj0j8 // ... $8 = 0x099e0a30 https://api.parse.com/1/classes/poem/cuptflj0j8 ... $18 = 0x0bb6d530 https://api.parse.com/1/classes/poem/cuptflj0j8 

note different memory addresses come afhttprequestoperation, i'm printing request.url property examine objectid (the random string on end of url) each request.

now i'm not familiar enough workings of nsincrementalstore or afincrementalstore figure out after 2 days of debugging , examination. i'd love hear thoughts around causing this, intentional or not.

i might add i'm using nsfetchedresultscontroller uitableview. followed stack trace of first request of object tableview's data source. other 2 requests trace methods internal afincrementalstore.

- (uitableviewcell*)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     // ...     nsmanagedobject *poem = [self.fetchedresultscontroller objectatindexpath:indexpath];     cell.textlabel.text = [poem valueforkey:@"title"];  // traced here     // ... } 

an option may setting nsurlcache so:

nsurlcache *urlcache = [[nsurlcache alloc] initwithmemorycapacity:8 * 1024 * 1024 diskcapacity:20 * 1024 * 1024 diskpath:nil];  [nsurlcache setsharedurlcache:urlcache]; 

this should set urlcache using 8 mb ram , 20 mb disk cache.

to check if there still many requests happening on wire, maybe use tool wireshark or cocoapacketanalyser.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -