Hello,
I'm having a problem with properties. First, I define it:
@property (readwrite) BOOL isPerformingOperation;
then synthesize it:
@synthesize isPerformingOperation;
Then I am setting the property as such:
self.isPerformingOperation = YES;
To make sure I've done things right, I log:
NSLog(@"class perform is %i",self.isPerformingOperation);
... which returns 1 as it is supposed to.
But then I need to read the property from another class - DAUpdatingView
, so I import the header file from the class I added the property to and try two ways of getting the value, which both always return 0, even when I set it in the original class to 1.
NSLog(@"My Boolean: %d, or %@", [USBBackupAppDelegate sharedInstance].isPerformingOperation, [USBBackupAppDelegate sharedInstance].isPerformingOperation ? @"Yes" : @"No");
This is the console output:
2010-10-12 19:32:11.381 USBBackup[3329:a0f] class perform is 1
2010-10-12 19:32:15.330 USBBackup[3329:a0f] My Boolean: 0, or No
As you can see, the main class where the property is from has changed the value as it was supposed to, but the other class doesn't read it. What am I missing?
Edit:
Yes, I am using a shared Instance of the original class:
static USBBackupAppDelegate *sharedInstance = nil;
+ (USBBackupAppDelegate *)sharedInstance
{
return sharedInstance ? sharedInstance : [[self alloc] init];
}