IOS5 -[__NSCFDictionary nombre]:无法识别的选择器发送到实例 0x6da25a0
尝试访问类“事件”Json 的属性时出现错误
全部列出 确定 当我尝试访问错误跳转时
Evento* bean = [ListaEventos objectAtIndex:indexPath.row];
DetalleViewController *detalle = [self.storyboard instantiateViewControllerWithIdentifier:@"Detalle"];
NSLog(@"detalle: %@",[bean nombre]);//bean Log OK!!, but bean.nombre Error!! why?
类: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
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
@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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从
[ListaEventos objectAtIndex:indexPath.row];
中得到的内容是NSDictionary
类型,而不是想象中的Evento
类型。检查你的数据!What you get out of
[ListaEventos objectAtIndex:indexPath.row];
is of kindNSDictionary
and not of kindEvento
as supposed. Check your data!您获得的对象
是字典类型,没有方法或属性名称。
如果您可以在此处添加 json,我们可以帮助您获取正确的 evento 对象。
The object you get with
Is of type dictionary which doesn't have the method or the property nombre.
If you could add also add here the json we can help you to get the correct evento object.