I assume my mistake is a very simple one, but alas here's the problem.
At the moment i'm trying to set my NSURL with this block from ViewControllerB
-(IBAction)changeUrl:(id)sender{
globalURL = [NSURL URLWithString:
@"http://secretUrl.fileExstension"];
viewControllerA *viewA = [[viewControllerA alloc] initWithNibName:@"viewControllerA" bundle:nil];
viewA.globalURL = [[NSURL alloc] init];
viewA.globalURL = globalURL;
[viewA.globalURL release];
}
And meanwhile in viewControllerA i'm doing this.
if (globalURL == nil) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"LOL NSURL IS NIL!"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else
{
// initates the request with set NSURL
}
So the main problem is that the NSURL is not properly keeping it's value while being passed between the views.
Any thoughts?
-(IBAction)changeUrl:(id)sender{
globalURL = [NSURL URLWithString:
@"http://secretUrl.fileExstension"];
viewControllerA *viewA = [[viewControllerA alloc] initWithNibName:@"viewControllerA" bundle:nil];
// viewA.globalURL = [[NSURL alloc] init]; //allocate this init method for viewcontrollerA
viewA.globalURL = globalURL;
// [viewA.globalURL release]; // Dont release here.
}