NSString outofscope issue
<p>My code is:</p>

<pre><code>- (void)viewDidLoad {
    [super viewDidLoad];
    self.appDelegate=[[UIApplication sharedApplication]delegate];
    self.dateString=[NSString stringWithFormat:@"%@",appDelegate.tappedDate];
    dateLabel.text=dateString;
}

-(IBAction)checkForData:(id)sender{
    NSString *bday=@"2012-01-26";
    if(bday==dateString)
    {
        UIAlertView *bdayView=[[UIAlertView alloc]initWithTitle:@"Birthday!!!" message:@"Its ur Best Friend's Bday" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [bdayView show];
        [bdayView release];
    }
    else{
        UIAlertView *bdayView=[[UIAlertView alloc]initWithTitle:@"No Data" message:@"No Data available for this date" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [bdayView show];
        [bdayView release];
    }
}
</code></pre>

<p>The String dateString is going out of scope in the if condition but it is displaying data on the label.</p>
