Resolved [_NSCFNumber setTableViewStyle:] unrecognized selector set to instance

Discussion in 'iOS Programming' started by moonman239, Nov 18, 2013.

  1. moonman239, Nov 18, 2013
    Last edited: Nov 18, 2013

    moonman239 macrumors 68000

    Mar 27, 2009
    I have a dynamic table view in a view controller that is set as both the table view's delegate and data source. I made sure to declare the subclass as a table view delegate and a table view data source. The table view is connected to the view controller's code via an outlet.

    Here is the subclass's implementation code. To keep my app's code a secret, I have replaced some pieces of code with
     // removed
    NSArray *managedObjects;
    NSArray *attributes;
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        return self;
    - (void)viewDidLoad
        [super viewDidLoad];
        attributes = @[// removed];
        AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
            NSEntityDescription *entityDescription = [NSEntityDescription entityForName:// removed inManagedObjectContext:[delegate managedObjectContext]];
            NSFetchRequest *request = [[NSFetchRequest alloc] init];
            [request setEntity:entityDescription];
            NSError *error;
            managedObjects = [[delegate managedObjectContext] executeFetchRequest:request error:&error];
            if (managedObjects == nil)
                NSLog([error localizedDescription]);
        [[self // removed] reloadData];
    -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
        return [managedObjects count];
    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
        return 3;
    -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
        return [[managedObjects objectAtIndex:section] valueForKey:// removed];
    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        NSManagedObject *managedObject = [managedObjects objectAtIndex:indexPath.section];
        return [managedObject valueForKey:[attributes objectAtIndex:indexPath.row]];
    - (void)didReceiveMemoryWarning
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    EDIT: I got the error because in my tableViewCellForRow method, I have the returned variable set to something other than a table view cell. Doh!
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
  3. Duncan C macrumors 6502a

    Duncan C

    Jan 21, 2008
    Northern Virginia
    Mark your thread as resolved

    Since you found your problem, please mark this thread as resolved:

    (See the thread Forum Feature: Resolved Thread Prefix for instructions.)


Share This Page