Pergunta

I have some code to change to another screen in my app:

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data {
    NSString *dataString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    NSLog(@"Performing Segue...");
    // Open detail segue
    [self performSegueWithIdentifier:@"DetailViewSegue" sender:dataString];
}

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)json
{
    NSLog(@"Testing...");
    // If we are going to the success view, send the JSON data over as well!
    if ([segue.identifier isEqualToString:@"DetailViewSegue"]) {
        DetailViewController *DetailViewControllerSegue = [segue destinationViewController];
        NSDictionary *jsonSendetAsParamInPerformSegue = (NSDictionary*)json;
        DetailViewControllerSegue.jsonString = jsonSendetAsParamInPerformSegue;

    }
}

When I attempt to perform the segue I get this error: -[UITextField length]: unrecognized selector sent to instance 0x14589970

What does error mean? And how can I resolve it?

Thanks,

Peter

Foi útil?

Solução 2

The reason this error appeared was because I had a typo in my Storyboard Segue Identifier and it didn't match:

@"DetailViewSegue"

in:

[self performSegueWithIdentifier:@"DetailViewSegue" sender:dataString];

I hope this helps others in the future

Peter

Outras dicas

UITextField doesn't have a selector called length. What you probably want is to call length on the text property of the text field.

[someTextField.text length]

(I actually don't see anything related to a text field in the posted code... but this is the only explanation per the given error message)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top