Pregunta

I am receiveing this error message when launching a IBAction from an NSView.

XXXX is AccountTableCellViewController I did put it with an abstract name in case it can help other prople.

This is the structure of the components:

I have an app where I load this view: enter image description here

Using this NSView as cell enter image description here

The TableView has been binded like this:

@property (nonatomic,retain) IBOutlet NSTableView *tableView;

I display the contents as follows (I have some doubts on not linking the controller anywhere)

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
    Account *account = (Account *)[self.dataSource objectAtIndex:row];

    AccountTableCellViewController *controller = [[AccountTableCellViewController alloc] initWithNibName:@"AccountTableCellViewController" bundle:nil ];
    controller.account = account;
    return [controller view] ;
}

Any idea?

¿Fue útil?

Solución

This is a pre-ARC equivalent of your code

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
    Account *account = (Account *)[self.dataSource objectAtIndex:row];

    AccountTableCellViewController *controller = [[AccountTableCellViewController alloc] initWithNibName:@"AccountTableCellViewController" bundle:nil ];
    controller.account = account;
    NSView *result = [[controller view] retain];
    [controller release]; /// !!!
    return [result autorelease];
}

Your controller is already deallocated at the moment tableView:viewForTableColumn: returns. You say in comments that you've tried to keep controllers in array but it doesn't help. Please update your question with a corresponding sections of the code, because something is wrong here.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top