Ich baue meine App nach dem Hinzufügen von Code, aber ich bekomme die Un-Recognized Selector an Instance Error gesendet stoppen meine App zu laufen. Hier ist ein Bild von dem Fehler -Nicht erkannte Selector an Instance-Fehler gesendet
alt text http://www.grabup.com/uploads/20f66eecee4bd96198c7bbcfe647ec74.png?direct
Dies ist der Code I hinzugefügt (es ist für die Datenquelle eines NSOutlineView)
- (id)init
{
self = [super init];
if (self != nil) {
// initialization code, rootsObjects is a NSArray instance variable
rootObjects = [NSArray arrayWithObjects:@"Joshua", @"Erne", nil];
}
return self;
}
// here NSOutlineView asks how many children rows to display for a given item
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
// if item is nil this should be a Root row, else I pass 0 for example but should be the count of objects contained in item
return (item == nil) ? [rootObjects count] : 0;
}
// here NSOutlineView asks if a given item can be expanded i.e contains children
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
// again I return YES for example, but should be based on the count of objects contained in item
return YES; //(item == nil) ? YES : ([item numberOfChildren] != -1);
}
// here NSOutlineView asks for the object (some treelike structure) assigned to the nth index child row of item
- (id)outlineView:(NSOutlineView *)outlineView
child:(int)index
ofItem:(id)item
{
// if item is nil I opass the appropriate Root row, else I pass nil for example but should be an object contained in item
return (item == nil) ? [rootObjects objectAtIndex:index] : nil;
}
// here NSOutlineView asks for the objectValue (usually a NSString)) to be displayed in tableColumn for the given item
- (id)outlineView:(NSOutlineView *)outlineView
objectValueForTableColumn:(NSTableColumn *)tableColumn
byItem:(id)item
{
// pass the object we want to display in the tableColumn for item
return item ;
// here I pass item for example since I know it's a NSString, but usually will be something to compute.
// the [tableColumn identifier] property (that can be set in Interface Builder) is very useful here.
}
// here NSOutlineView asks for the NSCell to be used by tableColumn for the given item
- (NSCell *)outlineView:(NSOutlineView *)ov
dataCellForTableColumn:(NSTableColumn *)tableColumn
item:(id)item
{
// the nil tableColumn represents the unified root row style
if (tableColumn == nil) {
// pass a cell we want to be used as root row (assume we've have assigned "Name" as identifier of some tableColumn)
return [[treeTable tableColumnWithIdentifier:@"Name"] dataCell];
}
// else just pass the default cell
return [tableColumn dataCellForRow:[treeTable rowForItem:item]];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
return YES;
}
Hier ist der Code I in der gleichen Datei haben (die Datenquelle) wie der obige Code.
Ich bin mir nicht sicher, ob die von Ihnen zur Verfügung gestellten Informationen ausreichend sind ... können Sie auch einen Stack-Trace hinzufügen? – fbrereto
Der Fehler im Debugger lieferte keinen Stack Trace. Wie sonst finde ich es? – Joshua
Geben Sie in der Debugger-Konsole "b objc \ _exception \ _throw" ein (oder fügen Sie eine Ausnahme mithilfe des Ausnahmenfensters hinzu, Run-> Show-> Breakpoints). Wenn der Debugger bricht, öffnen Sie das Debugger-Fenster (Run-> Debugger). Im oberen linken Bereich wird eine Stack-Kurve angezeigt. Irgendwo im Stach-Trace sehen Sie eine Kopie-Kopie Nachricht; Der erste Eintrag in Schwarz unter dem ist der Punkt in Ihrem Code, der das Problem auslöst. –