[英]IOS5 -[__NSCFDictionary nombre]: unrecognized selector sent to instance 0x6da25a0
I get an error when trying to access an attribute of a class "event" 尝试访问类“事件”的属性时出错
Json List all Ok When I trying to access the error jumps 杰森列出所有确定当我尝试访问错误跳转
Evento* bean = [ListaEventos objectAtIndex:indexPath.row];
DetalleViewController *detalle = [self.storyboard instantiateViewControllerWithIdentifier:@"Detalle"];
NSLog(@"detalle: %@",[bean nombre]);//bean Log OK!!, but bean.nombre Error!! why?
The class: evento.h 班级: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 Evento.m
@implementation Evento
@synthesize idevento;
@synthesize nombre;
@synthesize descripcion;
@synthesize fecha;
@synthesize telefono;
@synthesize direccion;
@end
What you get out of [ListaEventos objectAtIndex:indexPath.row];
你从[ListaEventos objectAtIndex:indexPath.row];
is of kind NSDictionary
and not of kind Evento
as supposed. 是一种善良的NSDictionary
而不是那种假设的Evento
。 Check your data! 检查你的数据!
The object you get with 你得到的对象
[ListaEventos objectAtIndex:indexPath.row];
Is of type dictionary which doesn't have the method or the property nombre. 是类型字典,没有方法或属性nombre。 If you could add also add here the json we can help you to get the correct evento object. 如果可以添加,还可以在此处添加json,我们可以帮助您获取正确的evento对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.