I'm receiving an error message when I run my app in Xcode (terminating app due to uncaught exception). Below I pasted the error message and what I believe is the part of the code that's creating the problem. I'm new and just learning objective c so please be easy with me. Thank you!
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); Thread 1:signal SIGABRT
}
}
The Error Message:
2014-11-25 10:07:19.794 SamplePhotoReDo[81276:108898068] * Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:6116 2014-11-25 10:07:19.798 SamplePhotoReDo[81276:108898068] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier AllPhotosCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard' *** First throw call stack:'
The script that I believe is causing the error:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;
NSString *localizedTitle = nil;
if (indexPath.section == 0) {
cell = [tableView dequeueReusableCellWithIdentifier:AllPhotosReuseIdentifier forIndexPath:indexPath];
localizedTitle = NSLocalizedString(@"All Photos", @"");
} else {
cell = [tableView dequeueReusableCellWithIdentifier:CollectionCellReuseIdentifier forIndexPath:indexPath];
PHFetchResult *fetchResult = self.collectionsFetchResults[indexPath.section - 1];
PHCollection *collection = fetchResult[indexPath.row];
localizedTitle = collection.localizedTitle;
}
cell.textLabel.text = localizedTitle;
return cell;
}