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 7660061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:24:53+00:00 2026-05-31T13:24:53+00:00

I am new to Xcode and Objective-C programming and need some help. I am

  • 0

I am new to Xcode and Objective-C programming and need some help.

I am looking to create a basic program for the iOS that uses hierarchal-data and 2 separate UITableViews. I want the second UITableView to be populated by an array that is passed between viewControllers, based on which cell/row is selected in the first UITableView.

The program compiles but I get a SIGABRT error when running the program. Can someone help me fix the SIGABRT and pass the mainArray to the second tableView?

Here is how far I have gotten.

My code:

ArrayTableViewController.h

@interface arrayTableViewController : UITableViewController
@property (nonatomic, strong) NSMutableArray *mainArray;
@property (nonatomic, strong) NSMutableArray *secondArray;
@property (nonatomic, strong) NSMutableArray *thirdArray;
@end

ArrayTableViewController.m

#import "ArrayTableViewController.h"
#import "table2.h"
@implementation arrayTableViewController
@synthesize mainArray, secondArray, thirdArray;

-(void) viewDidLoad {
[super viewDidLoad];
mainArray = [[NSMutableArray alloc] initWithObjects: secondArray,     thirdArray, nil];
secondArray = [[NSMutableArray alloc] initWithObjects: @"123", @"456",     nil];
thirdArray = [[NSMutableArray alloc] initWithObjects: @"78", @"90", nil];
}



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

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

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

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}


cell.textLabel.text = [mainArray objectAtIndex:[indexPath row]];

return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

table2 *table2Controller = [[table2 alloc] initWithNibName:@"table2" bundle:nil];
table2Controller.arrayForDisplay = [[mainArray objectAtIndex: [indexPath row]] objectAtIndex:1];
[self.navigationController pushViewController:table2Controller animated:YES];

}

@end

table2.h

#import <UIKit/UIKit.h>
@interface table2 : UITableViewController
@property (nonatomic, strong) NSArray *arrayForDisplay;
@end

table2.m

@implementation table3
@synthesize arrayForDisplay;

Then the same cell configuration style that was used in ArrayTableViewController.m

Edits:

After making the necessary changes, when I run the program and select a row, I get a SIGABRT error at the following line.

int main(int argc, char *argv[])
{
@autoreleasepool {
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([ArrayTableAppDelegate class]));
}
}

What would you recommend? Should I turn off ARC and call my own releases? so that I can get to the second tableView?

  • 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-31T13:24:54+00:00Added an answer on May 31, 2026 at 1:24 pm

    First mistake:

    In viewDidLoad method, you have created the mainArray with secondArray and thirdArray as elements even before you allocated those arrays.

    Second mistake:

    In cellForRowAtIndexPath: method:

    Check the line cell.textLabel.text = [mainArray objectAtIndex:[indexPath row]];

    Actually the textLabel expects a NSString value to set. But you are setting an array.

    Edit:

    Set the value to textLabel as following:

    cell.textLabel.text = [[mainArray objectAtIndex:[indexPath row]] objectAtIndex:0];
    

    Actually this will set the first value of the array. But that it depends on your requirement.

    Edit 2:

    arrayForDisplay is an array variable but you are setting a string variable to that in the statement

    table2Controller.arrayForDisplay = [[mainArray objectAtIndex: [indexPath row]] objectAtIndex:1];
    

    Do it as follows:

    table2Controller.arrayForDisplay = [mainArray objectAtIndex: [indexPath row]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Xcode and objective C programming and I'm having some troubles building
I am new to Xcode and objective C programming.Please help me to resolve the
Hey there, I'm a designer thats really new to programming with xcode or Objective-C
I am new to Mac, iOS, Xcode and objective-c. I am very familiar with
I am programming a hello world program and I'm new to Xcode. I followed
In Xcode when you create a new objective c unit test case, it asks
Am new to objective-c and xcode, and i love programming with them. But am
I am fairly new to XCode and the Objective-C language. When I am instantiating
I am fairly new to XCode and the Objective-C language. When I am instantiating
I am relatively new to Xcode and one thing that has bothered me is

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.