tags:

views:

23

answers:

1
NSString *navTitle = self.navigationItem.title;

NSURL *address = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.twostepmedia.co.uk/json.php?q=%@",navTitle]];
responseData = [[NSMutableData data] retain];   
NSURLRequest *request = [NSURLRequest requestWithURL:address];
[[NSURLConnection alloc] initWithRequest:request delegate:self];

Anyone have any idea why this wouldnt work, this is in the viewDidLoad method.

Thanks

A: 

I assume because self.navigationItem is not initialized until viewWillAppear:.

St3fan
ah, ok where do i need to initialise it then? how do i structure this bit of code? thanks
benhowdle89
Don't think this is the problem since I've accessed `self.navigationItem.title` lots of times in `viewDidLoad` (iirc)
Rengers
i've just tested it by setting a label's text as the nav title and using that in the url, but instead the PHP returns "Label"...ie, it didnt receive any text from the label, just that it was a label!?
benhowdle89
Try logging the text using `NSLog(@"Title: %@",self.navigationItem.title)` so you can see what the value actually is.
Rengers