Assertionsfehler in UITableViewController
Nehme ich die iTunes U Stanford iOS Klasse und arbeite an einem der Zuweisungen zu bauen, ein kleines Flickr-app. Ich erhalte eine Fehlermeldung, dass ich nicht scheinen, um in der Lage sein, zu Debuggen, was kommt als
* Assertionsfehler in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2280.1/UITableView.m:5336 2012-08-03
10:59:24.596 Zuordnung 4[4611:c07] (null) libc++abi.dylib: kündigen
genannt, eine Ausnahme zu werfen
Mein code für die tableviewcontroller in Frage:
#import "PlacesPhotosTableViewController.h"
@interface PlacesPhotosTableViewController ()
@property (nonatomic) NSDictionary *placeToDisplay;
@property (nonatomic) NSArray *photosInPlace;
@end
@implementation PlacesPhotosTableViewController
@synthesize placeToDisplay = _placeToDisplay;
@synthesize photosInPlace = _photosInPlace;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
//Custom initialization
}
return self;
}
- (id)init
{
self = [super init];
return self;
}
- (id)initWithPlace:(NSDictionary *)place
{
self = [self init];
if (self)
{
self.placeToDisplay = place;
}
return self;
}
- (NSArray *)photosInPlace
{
if (_photosInPlace == nil)
{
_photosInPlace = [FlickrFetcher photosInPlace:self.placeToDisplay maxResults:50];
}
return _photosInPlace;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog([self.placeToDisplay valueForKeyPath:@"description._content"]);
//Uncomment the following line to preserve selection between presentations.
//self.clearsSelectionOnViewWillAppear = NO;
//Uncomment the following line to display an Edit button in the navigation bar for this view controller.
//self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
//Dispose of any resources that can be recreated.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
//Return the number of rows in the section.
return [self.photosInPlace count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Photos";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSString *string = [[self.photosInPlace objectAtIndex:indexPath.row] valueForKeyPath:@"description._content"];
cell.textLabel.text = string;
return cell;
}
InformationsquelleAutor der Frage gsapienza | 2012-08-03
Du musst angemeldet sein, um einen Kommentar abzugeben.
CellIdentifier
Ich Wette IhrcellForRowAtIndexPath
zurücknil
.Das ist wahrscheinlich der Grund, warum
[UITableView _configureCellForDisplay:forIndexPath:]
versagt... weilcellForRowAtIndexPath
ist wieder ein null-Wert, und dannconfigureCellForDisplay
erwartet einUITableViewCell
.InformationsquelleAutor der Antwort jerrylroberts
Diese Zeile hier
Macht dieses match für die cell-id in das storyboard? Ich habe diese nicht übereinstimmende war die Ursache für das problem für mich!
InformationsquelleAutor der Antwort Matt Rees
Ich Stand vor dem gleichen problem und lösen es, weil ich vergaß hinzuzufügen,
nun gelöst sein.
InformationsquelleAutor der Antwort mahendra
Sind Sie nicht die Schaffung Zelle in der Methode
Nur die Wiederverwendung der Zelle von dieser Methode gibt
nil
zunächst.Müssen Sie Zelle erstellen, indem Sie das unten gegebene code in der Methode.
InformationsquelleAutor der Antwort Baalu