Objective C Json not working in viewDidLoad
NSString *navTitle = self.navigationItem.title;
NSURL *address = [NSURL URLWithString:[NSString stringWithFormat:@"h开发者_开发知识库ttp://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
I assume because self.navigationItem
is not initialized until viewWillAppear:
.
精彩评论