मैं बिल्कुल इस से बम्बोज़ल हूं और मैं जो खो रहा हूं उसे बाहर नहीं कर सकता। कोर डेटा के बारे में शायद अभी भी बहुत कुछ सीखना है।अनुभाग प्राप्त करने वाले परिणाम नियंत्रक ब्रेक खोज प्रदर्शन
यह मेरा लाई गई परिणाम नियंत्रक जो प्रदर्शित करता है एक वर्ग-कम तालिका लेकिन मेरे खोज प्रदर्शन नियंत्रक काम करता है:
self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request
managedObjectContext:self.buckyballDatabase.managedObjectContext
sectionNameKeyPath:nil
cacheName:nil];
जैसे ही मैं एक sectionNameKeyPath लागू के रूप में जबकि, अनुभाग जोड़ने के लिए। धारा जोड़ दिए जाते हैं, लेकिन मेरी खोज प्रदर्शन नियंत्रक टूटी हुई है, नीचे त्रुटि फेंक:
*** Assertion failure in -[UITableViewRowData rectForRow:inSection:], /SourceCache/UIKit_Sim/UIKit-2372/UITableViewRowData.m:1630
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for rect at invalid index path (<NSIndexPath 0x7481040> 2 indexes [0, 1])'
और यहाँ मेरी तालिका दृश्य पर डेटा स्रोत कार्यान्वयन हैं कहाँ filteredList एक NSArray है: -
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if (tableView == self.tableView)
{
return [[self.fetchedResultsController sections] count];
}
else
{
return 1;
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.tableView)
{
return [[[self.fetchedResultsController sections] objectAtIndex:section] numberOfObjects];
}
else
{
return [self.filteredList count];
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if (tableView == self.tableView)
{
return [[[self.fetchedResultsController sections] objectAtIndex:section] name];
}
else
{
return nil;
}
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
if (tableView == self.tableView)
{
if (index > 0)
{
return [self.fetchedResultsController sectionForSectionIndexTitle:title atIndex:index-1];
}
else
{
self.tableView.contentOffset = CGPointZero;
return NSNotFound;
}
}
else
{
return 0;
}
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
if (tableView == self.tableView)
{
NSMutableArray *index = [NSMutableArray arrayWithObject:UITableViewIndexSearch];
NSArray *initials = [self.fetchedResultsController sectionIndexTitles];
[index addObjectsFromArray:initials];
return index;
}
else
{
return nil;
}
}
अपवाद को सेलफोररोएट इंडेक्सपैथ में नीचे दी गई रेखा पर फेंक दिया गया है: -
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
अधिक जानकारी प्रदान करने की आवश्यकता है, तो पूछना कृपया .. मैं अपने सिर इस पर इतना .. खरोंच कर रहा हूँ
उपयोग करने का प्रयास का उपयोग कर '-dequeueReusableCellWithIdentifier का प्रयास करें:' और 'नहीं -dequeueReusableCellWithIdentifier: forIndexPath: '। – chris
उस @chris के लिए धन्यवाद ... यह खोज प्रदर्शन नियंत्रक काम कर रहा है। लेकिन मूल डेटा में कोई भी अपडेट (हटाए जाने वाले जोड़े) तालिका को तोड़ देता है जैसे सभी डेटा इंडेक्स और अनुभाग नामों को छोड़कर गायब हो जाते हैं। यह चीज़ सेक्शनिंग और इंडेक्सिंग के बिना काम करती है :-(त्रुटि: कोरडाटा: त्रुटि: गंभीर एप्लिकेशन त्रुटि। कॉल करने के दौरान एनएसफ़ेटेड रीसेट कंट्रोलर के प्रतिनिधि से एक अपवाद पकड़ा गया था- नियंत्रक डिड चेंज सामग्री: ***- [__ एनएसएआरआरएमएम डालने ऑब्जेक्ट: atIndex:] : userInfo (null) –
के साथ ऑब्जेक्ट शून्य नहीं हो सकता है इसे आज़माएं: http://stackoverflow.com/questions/3077332/how-to-refresh-a-uitableviewcontroller-or-nsfetchedresultscontroller – MCKapur