Hi,
I created a subclass of NSObject called "subscription". In my UIViewController I have this "subscription"-Object as an instance variable.
In the "initWithNibName"-Method of the ViewController I also instantiate the "subscription"-Model:
Interface of the ViewController:
Code:
import "SubscriptionModel.h"
...
SubscriptionModel *subscription;
...
In the "initWithNibName"-Method I allocate the model as follows:
Code:
...
subscription = [[SubscriptionModel alloc] initWithDatabase:YES];
...
When I now try to set one of the attributes (e.g. "name") the debugger will show "out of scope". I add the attribute like this:
Code:
...
subscription.name = @"First Subscription";
...
The SubscriptionModel is a subclass of NSObject which has a init-Method which looks like this:
Code:
- (id)initWithDatabaseAccess:(BOOL)connectToDatabase {
if ( (self = [super init]) ) {
name = [[NSString alloc] init];
created = [NSDate date];
}
return self;
}
The property "name" is defined as instance variable and property:
Code:
NSString *name;
...
@property (nonatomic, retain) NSString *name;
...
The "created"-Attribute is out of scope as well. If I call [NSDate date]; in the ViewController, it works fine.
What am I doing wrong? Has anybody an idea which I could go for?
If you need further input let me know.
Thanks for help!