I have two viewcontrollers mainVC and drop_downVC. I also have an object called JSONutils. The user will enter input into a textfield in the mainVC viewcontroller and methods are then used in the JSONutils to contact a RESTful api and a JSON object is then returned and parsed. I'd like to segue to the drop_downVC viewcontroller when the connectionDidFinishLoading method in JSONutils completes. Everything is working up to the point of trying to segue to the drop_downVC. From the research I've been doing it seems using the performSegueWithIdentifier is the way to go. So below is the code that I'm trying to implement in the connectionDidFinishLoading method in JSONutils.
//JSONutils.m
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
//NSLog(@"Succeeded! Received %d bytes of data",[receivedData length]);
//NSLog(@"The receivedData is: %@", receivedData);
//JSON parsing code from here to
//here...
[self performSegueWithIdentifier:@"segue_drop_downVC" sender:self];
}//(void)connectionDidFinishLoading
the above code gives me the following error.
No visible @interface for 'JSONutils' declares the selector 'performSegueWithIdentifier:sender:'
I've googled this error but can't find anything that applies to my specific solution.
I created the segue and named the segue identifier appropriately (segue_drop_downVC) using this post.
I've also been putting the following code anywhere (JSONutils, mainVC) possible to see if that would change anything but it hasn't.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
//NSLog(@"The segue identifier is: %@", [segue identifier]);
//if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
drop_downVC *nextViewController = [segue destinationViewController];
}
I don't have much experience programming in Objective-C but when I have I've used storyboard and segue to move between viewcontrollers. When I have used storyboard and segues I've "segued" when the user hit a button. I've never had to wait for data to come back and then navigated to the next viewcontroller. My plan is continue to put all of my JSON manipulating and parsing methods in the JSONutils files. So I'd like to keep those type of methods out of mainVC and drop_downVC. I've been doing research, trying different things but can't seem to get it. Any help or feedback is greatly appreciated! Thanks.