IOS5 -[__ NSCFDictionary Nombre]: Nicht anerkannter Selektor, der an Instanz 0x6da25a0 gesendet wurde
-
25-10-2019 - |
Frage
Ich erhalte einen Fehler, wenn ich versuche, auf ein Attribut einer Klasse "Ereignis" zuzugreifen
JSON LISTE ALLES OK, wenn ich versuche, auf die Fehler Jumps zuzugreifen
Evento* bean = [ListaEventos objectAtIndex:indexPath.row];
DetalleViewController *detalle = [self.storyboard instantiateViewControllerWithIdentifier:@"Detalle"];
NSLog(@"detalle: %@",[bean nombre]);//bean Log OK!!, but bean.nombre Error!! why?
Die Klasse: evento.h
@interface Evento : NSObject
@property (strong, nonatomic) NSString *idevento;
@property (strong, nonatomic) NSString *nombre;
@property (strong, nonatomic) NSString *descripcion;
@property (strong, nonatomic) NSString *fecha;
@property (strong, nonatomic) NSString *telefono;
@property (strong, nonatomic) NSString *direccion;
@end
Evento.m
@implementation Evento
@synthesize idevento;
@synthesize nombre;
@synthesize descripcion;
@synthesize fecha;
@synthesize telefono;
@synthesize direccion;
@end
Lösung
WAS SIE ERHALTEN [ListaEventos objectAtIndex:indexPath.row];
ist von Art NSDictionary
Und nicht von Art Evento
wie angenommen. Überprüfen Sie Ihre Daten!
Andere Tipps
Das Objekt, mit dem Sie bekommen
[ListaEventos objectAtIndex:indexPath.row];
Ist vom Typ Wörterbuch, das weder die Methode noch die Eigenschaft Nombre hat. Wenn Sie hier auch hinzufügen können, können wir Ihnen helfen, das richtige Evento -Objekt zu erhalten.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow