Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7443829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:23:40+00:00 2026-05-29T11:23:40+00:00

From a tableview to another table view (using Xcode 4.2 and iOS 5). FirstPage.h

  • 0

From a tableview to another table view (using Xcode 4.2 and iOS 5).

FirstPage.h

#import "FavoritesController.h"

#import "Profiles.h"

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    FavoritesController * favoriteview = [[FavoritesController alloc] init];
    [favoriteview setTitle:@"Favorites"];

    NSMutableArray * profiles = [[NSMutableArray alloc]init ];
    profiles = [NSMutableArray arrayWithCapacity:20];

    Profiles * profile = [[Profiles alloc]init];
    profile.profile_name = @"Woot";
    profile.biz_type_desc = @"Woot 1";
    profile.profile_address = @"123, woot";
    profile.profile_email = @"woot@woot.com";
    [profiles addObject:profile];
    profile=[[Profiles alloc]init];
    profile.profile_name = @"Jin-Aurora";
    profile.biz_type_desc = @"Software";
    profile.profile_address = @"682A";
    profile.profile_email = @"jin@jin.biz";
    [profiles addObject:profile];

    [self.navigationController pushViewController:favoriteview animated:YES];
    favoriteview.profilelist = profiles; 
}

FavoriesController.h

@interface FavoritesController : UITableViewController

@property(nonatomic,strong)NSMutableArray * profilelist;

@end

FavoriteController.m

 #import "FavoritesController.h"
 #import "Profiles.h"
 #import "ProfileCell.h"

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
   return [self.profilelist count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ProfileCell";

    ProfileCell *cell = (ProfileCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    Profiles * profile = [self.profilelist objectAtIndex:indexPath.row];

    cell.nameLabel.text = profile.profile_name;
    cell.biztypeLabel.text = profile.biz_type_desc;

    // Configure the cell...

    return cell;
}

Storyboard Table View

  • Picture of prototype cell xib with Identity inspector
  • Picture of prototype cell xib with Attributes inspector

This is the error I got

2012-02-08 22:28:37.719 test[4668:f803] Terminating app due to
uncaught exception ‘NSInternalInconsistencyException’, reason:
‘UITableView dataSource must return a cell from
tableView:cellForRowAtIndexPath:’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:23:41+00:00Added an answer on May 29, 2026 at 11:23 am

    I’m not quite sure what you’re trying to do here:

    NSMutableArray * profiles = [[NSMutableArray alloc]init ];
    profiles = [NSMutableArray arrayWithCapacity:20];
    

    The first line creates a new mutable array called profiles. The second line creates an autoreleased mutable array with capacity 20 and assigns it to profiles. So you’re basically covering up the array you created in the first line. You can either say

    NSMutableArray *profiles = [[NSMutableArray alloc] initWithCapacity:20];
    

    or

    NSMutableArray *profiles = [NSMutableArray arrayWithCapacity:20];
    

    The reason you’re crashing, as mentioned by @wattson12 is that you are dequeueing a cell that hasn’t been created. You always want to try and dequeue a cell, but if one doesn’t exist, you need to create one. Again, @wattson12 has provided the necessary code for that task.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was calling UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; from -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath in
The debugger threw me this error UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
I'm loading a view from a tableview touched cell that contains a photo that
From the docs: A table view in the UIKit framework is limited to a
From the docs: A plain-style table view is an unbroken list; a grouped table
I am deriving from TableViewCell. When i query the table view about an index
I currently have the following code that loads a UIWebView from another View. Now
How can I move from the current view to another view? My current view
I am having a problem with a table and showing another view when the
I'm having a weird problem using [UIImage imageNamed:] method to set table view cells'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.