2012-02-15 36 views
1

我在嘗試訪問類的「事件」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 
+1

顯然,'bean'是一個'NSDictionary',而不是'Evento'的一個實例。最有可能的是,你需要啓用NSZombies並尋找過度釋放。 – Costique 2012-02-15 20:29:53

回答

3

你從[ListaEventos objectAtIndex:indexPath.row];得到的是NSDictionary種類,而不是種類Evento。檢查你的數據!

+3

並且順便檢查一下objective-c變量的命名約定。 – fbernardo 2012-02-15 20:33:01

+0

謝謝你,是一個菜鳥的錯誤,而不是保存的對象不斷dictionario不適當的命名=錯誤...感謝和抱歉的愚蠢的問題xD – 2012-02-15 20:54:36

+0

不客氣,我們都在那裏!如果您的問題現在已解決,請通過接受適當的答案來解決問題。 – tilo 2012-02-15 21:03:18

0

[ListaEventos objectAtIndex:indexPath.row]; 

得到的對象是沒有方法或屬性農佈雷型詞典。 如果你可以添加這裏添加json我們可以幫助你獲得正確的事件對象。

相關問題