ios - FetchResultsController displaying no sections -
for reason, code below producing weird output.
#define initial_batch_size 500 // initializes nsfetchedresultscontroller following request - (void)initializefetchresultscontroller { // makes request given entity nsfetchrequest *request = [nsfetchrequest fetchrequestwithentityname:@"tweet"]; request.predicate = nil; request.sortdescriptors = @[[nssortdescriptor sortdescriptorwithkey:@"timestamp" ascending:no]]; request.fetchbatchsize = initial_batch_size; nsarray *matches = [self.managedobjectcontext executefetchrequest:request error:null]; nslog(@"%d", [matches count]); // creates fetchedresultscontroller self.fetchedresultscontroller = [[nsfetchedresultscontroller alloc] initwithfetchrequest:request managedobjectcontext:self.managedobjectcontext sectionnamekeypath:nil cachename:nil]; }
when print out matches count
144192, when print out number of sections in self.fetchedresultscontroller
0 using code below.
- (nsinteger)numberofsectionsintableview:(uitableview *)tableview { nslog(@"sections: %d", [[self.fetchedresultscontroller sections] count]); return [[self.fetchedresultscontroller sections] count]; }
i had initialized code in view did load , during debugging noticed self.fetchedresultscontroller
initialized problem not deal initialized self.fetchedresultscontroller
.
i trying find out reason cannot. more information, have uiviewcontroller contains tableview in hooked delegate , datasource don't think there problem causing issue.
Comments
Post a Comment