program received signal SIGABRT (xcode)

Posted by manish1990 on Stack Overflow See other posts from Stack Overflow or by manish1990
Published on 2012-04-27T08:06:50Z Indexed on 2012/11/27 11:05 UTC
Read the original article Hit count: 130

#import <UIKit/UIKit.h>

@interface tableview : UIViewController<UITableViewDataSource>

{
    NSArray *listOfItems;
}
@property(nonatomic,retain) NSArray *listOfItems;

@end

#import "tableview.h"

@implementation tableview
@synthesize listOfItems;

- (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 ]autorelease];
    }

    //NSString *cellValue = [listOfItems objectAtIndex:indexPath.row];
    cell.textLabel.text = [listOfItems objectAtIndex:indexPath.row];
    return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    listOfItems = [[NSArray alloc] initWithObjects:@"first",@"second",@"third", nil];

    //listOfItems = [[NSMutableArray alloc]init];
   // [listOfItems addObject:@"first"];
    //[listOfItems addObject:@"second"];
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

-(void)dealloc
{
    [listOfItems release];
    [super dealloc];
}



@end

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 438. 2012-04-27 13:33:23.276 tableview test[438:207] -[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x6855500 2012-04-27 13:33:23.362 tableview test[438:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x6855500' * First throw call stack: (0x13bb052 0x154cd0a 0x13bcced 0x1321f00 0x1321ce2 0x1ecf2b 0x1ef722 0x9f7c7 0x9f2c1 0xa228c 0xa6783 0x51322 0x13bce72 0x1d6592d 0x1d6f827 0x1cf5fa7 0x1cf7ea6 0x1d8330c 0x23530 0x138f9ce 0x1326670 0x12f24f6 0x12f1db4 0x12f1ccb 0x12a4879 0x12a493e 0x12a9b 0x2282 0x21f5) terminate called throwing an exceptionCurrent language: auto; currently objective-c (gdb)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c