Sto adattando This tutorial alla mia app e l'ho ridotto a un ultimo errore, che mi impedisce di rimanere nelle mie tracce. Il programma non è in grado di trovare una proprietà in un altro file, ma quella proprietà è chiaramente definita. Ecco il codice in questione:Impossibile trovare la proprietà nell'oggetto forwarding
La linea errore effettivo:
for (DTContact *dtc in _dtContact.contact) {
il .h per il file, e gli elementi in questione:
#import <UIKit/UIKit.h>
@class XMLTestViewController;
@class DTCXMLResponse;
@interface XMLTestController : UIViewController{
UIWindow *window;
XMLTestViewController *viewController;
DTCXMLResponse *_dtContact;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet XMLTestViewController *viewController;
@property (nonatomic, retain) DTCXMLResponse *dtContact;
@property (nonatomic, retain) IBOutlet UIButton *mybutton;
-(IBAction)buttonClicked;
@end
sta avendo problemi con la _dtContact.contact . Non riesce a trovare il contatto nel file DTCXMLResponse. Ecco il file .h e la sezione del .m:
.h
#import <Foundation/Foundation.h>
@interface DTContactXMLResponse : NSObject {
NSMutableArray *_contact;
}
@property (nonatomic, retain) NSMutableArray *contact;
@end
.m
#import "DTCXMLResponse.h"
@implementation DTContactXMLResponse
@synthesize contact = _contact;
- (id)init {
if ((self = [super init])) {
self.contact = [[NSMutableArray alloc] init];
}
return self;
}
@end
ce n'è almeno questo. Come puoi vedere, ho "contact" propertied in DTCXMLResponse.h e collegato nel .m.
Una nota, la riga 'self.contact = [[NSMutableArray alloc] init];' dovrebbe essere effettivamente 'self.contact = [NSMutableArray array];', poiché la proprietà conserva già la matrice. –
Ho risolto il problema, grazie. –