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

  • Home
  • SEARCH
  • 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 555575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:49:43+00:00 2026-05-13T11:49:43+00:00

The application is very simple, a nevigationviewcontroller that navigates to a tableview. But when

  • 0

The application is very simple, a nevigationviewcontroller that navigates to a tableview.
But when i´m accessing to langsarray, it crashes

Here is the relevant code:

MenuViewController.m
-(void) Settings{
    TestViewController *testvc = [[TestViewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    [self.navigationController pushViewController:testvc animated:YES];
    [testvc release];   
}

#import <UIKit/UIKit.h> 
@interface TestViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>         
{ 
    NSArray *langsarray;
} 
@property (nonatomic, retain) NSArray *langsarray;
@end 



#import "TestViewController.h"

@implementation TestViewController
@synthesize langsarray;


- (void)loadView {
    //Create the table
    UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];  
    tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;  
    tableView.delegate = self;  
    tableView.dataSource = self;    
    [tableView reloadData];     
    self.view = tableView;  

    //read the info
    NSString *path = [[NSBundle mainBundle] pathForResource:@"l" ofType:@"txt"];
    NSString *langs = [[NSString alloc]initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
    langsarray = [langs componentsSeparatedByString: @"\n"];

    [path release];
    [langs release];
    [tableView release];

}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {  

    //Accessing langsarray crash the app
    //harcoded works fine: return 5;
    return [langsarray count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: 
                             SimpleTableIdentifier]; 
    if (cell == nil) { 
        cell = [[[UITableViewCell alloc] 
                 initWithStyle:UITableViewCellStyleSubtitle 
                 reuseIdentifier:SimpleTableIdentifier] autorelease]; 
    } 

    NSUInteger row = [indexPath row]; 
    // again, accessing langsarray crash the app
    cell.textLabel.text = [[[langsarray objectAtIndex:row] componentsSeparatedByString:@"="] objectAtIndex:0];
    cell.detailTextLabel.text = [[[langsarray objectAtIndex:row] componentsSeparatedByString:@"="] objectAtIndex:1];

    return cell;
} 

This is the output

Program received signal:
“EXC_BAD_ACCESS”. warning: Couldn’t
find minimal symbol for “_sigtramp” –
backtraces may be unreliable kill

Xcode 3.1.4
leopard

  • 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-13T11:49:44+00:00Added an answer on May 13, 2026 at 11:49 am

    Your problem is on this line:

    langsarray = [langs componentsSeparatedByString: @"\n"];
    

    The value returned on the right hand side is autoreleased, meaning that it’s already been deallocated when you read it later on.

    Try the following change:

    self.langsarray = [langs componentsSeparatedByString: @"\n"];
    

    This will make it use the property, which will automatically retain it for you. You could also consider retaining it manually.

    Update to respond to comment…

    1. What does langs contain before you split it into components? Are you sure that there’s a real string there? Does langsarray contain what you’re expecting immediately after the assignment?

    2. What is actually crashing in numberOfRowsInSection? Is the value you’re returning causing the crash or is it the fact that you’re counting an corrupt object? (For example, returning zero for the number of sections in the table used to — and may still — cause a crash.)

    I’d split the code out like this:

    NSUInteger c = [self.langsarray count];
    return c;
    

    That way you can set a breakpoint and see the value of c.

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

Sidebar

Ask A Question

Stats

  • Questions 349k
  • Answers 349k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer writing questions here helps thinking about solutions... and I found… May 14, 2026 at 6:48 am
  • Editorial Team
    Editorial Team added an answer You'll want to do something like CGRect box = CGPDFPageGetBoxRect(page,… May 14, 2026 at 6:48 am
  • Editorial Team
    Editorial Team added an answer Typically you will pass the address of the first element… May 14, 2026 at 6:48 am

Related Questions

What would be the best DB for Inserting records at a very high rate.
I'm working on an app which takes in a raw binary message (very simple,
I am writing an application where one of the features is to allow the
Imagine an in-house application aimed at the very technical user. The app maintains data.
A very simple situation. I'm working on an application in Delphi 2007 which is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.