In my .h file
@interface DemoApp : UIViewController {
UITextView *textView;
@private
NSString *status;
NSInteger *track1Len,*track2Len;
}
@property (nonatomic,retain) NSString *status;
In .m file
@synthesize status;
- (void)onDecodeCompleted:(NSString *)sts
{
status=sts;
NSLog(@"status is %@",status);
}
- (IBAction)processButton:(id)sender
{
NSLog(@"status is %@",status);
// here I am getting null value
}
I just to access my variable throughout my class file.In ondecodecompleted method,I am getting the value that is passed as parameter but after the process button is pressed I am getting null value.
try:
self.statusin both places.Also since you are using
NSStringwhich has a mutable subclass, you should mark it ascopyand notretain@property (nonatomic,copy) NSString *status;