Issues with #import and @class cause _OBJC_CLASS_ referenced from error-Collection of common programming errors
I have two classes.
APPagine.h
#import
@interface APPagineMedia : NSObject
@property (nonatomic, retain) NSString *Immagine;
@property (nonatomic, retain) NSString *Video;
@end
@interface APPagineDescription : NSObject
@property (nonatomic, retain) NSString *Descrizione;
@end
@interface APPagineSommarioLinee : NSObject
@property (nonatomic, retain) NSString *Description;
@property (nonatomic, assign) int IdLinea;
@end
@interface APPagineSommarioCategorie : NSObject
@property (nonatomic, retain) NSString *Nome;
@property (nonatomic, assign) int DestId;
@property (nonatomic, retain) APPagineSommarioLinee *Linee;
@end
@interface APPagineSommario : NSObject
@property (nonatomic, retain) APPagineSommarioCategorie *Categorie;
@end
@interface APPagine : NSObject
@property (nonatomic, assign) NSString *Layout;
@property (nonatomic, assign) int Indice;
@property (nonatomic, retain) NSString *Titolo;
@property (nonatomic, retain) APPagineMedia *Media;
@property (nonatomic, retain) APPagineDescription *Descrizione;
@property (nonatomic, retain) APPagineSommario *Sommario;
@end
APXmlData.h
@interface APXmlData : NSObject
@property (nonatomic, retain) NSString *Lingua;
@property (nonatomic, assign) float Versione;
@property (nonatomic, assign) long long Timestamp;
@property (nonatomic, retain) APPagine *Pagine;
@property (nonatomic, retain) APCategorie *Categorie;
@property (nonatomic, retain) APCarousel *Carousel;
@end
and finally in my controller interface:
#import "APXmlData.h"
@interface APViewController : UIViewController
{
APXmlData *_XmlData;
}
@end
and in implementation:
_XmlData.Timestamp = 123;
_XmlData.Version = 1.0;
_XmlData.Pagine = [[APPagine alloc] init];
_XmlData.Pagine.Layout = @"a";
_XmlData.Pagine.Indice = 1;
_XmlData.Pagine.Titolo = @"titolo";
//[...]
But,
in when i go to set data to
_XmlData.Pagine = [[APPagine alloc] init];
he returns me a linker error, the classic
Undefined symbols for architecture i386: “_OBJC_CLASS_$_APPagineDescription”, referenced from:
objc-class-ref in APPagine.o
“_OBJC_CLASS_$_APPagineMedia”, referenced from: objc-class-ref in APViewController.o
objc-class-ref in APPagine.o
“_OBJC_CLASS_$_APPagineSommario”, referenced from:
objc-class-ref in APPagine.old: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
My question is: what is correct way to import
the classes in my controller?
Should be use #import
or @class
? In that order?
What are the classes that require @class
or #import
?
NOTE
In Build -> Compile Sources, both files are properly configured.
If i remove _XmlData.Pagine = [[APPagine alloc] init];
the apps run well
thanks.