I got intermitent error when try to use nib that was registered for reuse. Im using the same custom cell on two ViewControllers.
2013-09-05 11:04:08.476 xxx[51395:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'invalid nib registered for identifier (TweetTableViewCellId) - nib must contain exactly one top level object which must be a UITableViewCell instance'
// First Controller to use custom Cell
@implementation TweetsViewController
- (void) viewDidLoad
{
...
UINib *nib = [UINib nibWithNibName:kTweetTableViewCellNibName bundle:nil];
[self.tweetsTableView registerNib:nib forCellReuseIdentifier:@"TweetTableViewCellId"];
..
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TweetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kTweetTableViewCellId forIndexPath:indexPath];
...
}
@end
// second Controller to use custom Cell
@implementation OfflineEpisodeModalViewController
- (void) viewDidLoad
{
UINib *nib = [UINib nibWithNibName:kTweetTableViewCellNibName bundle:nil];
[self.tweetSearchTableView registerNib:nib forCellReuseIdentifier:kTweetTableViewCellId];
}
...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TweetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TweetTableViewCellId" forIndexPath:indexPath];
}
@end
any suggestion?
I had a label that was not under the "content view" in XIB file elements list on left hand side.
I removed that label and it worked.
RESOLVED
Is simple, but anyway, is valid as a new knowledge: if you declare a xib file with the same name (my mistake), the file that will be loaded isnt guaranteed.
I delete the "forgotten" xib file and works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With