Nella mia app iOS sto cercando di aggiornare le informazioni dell'utente nel database (con Stackmob), ma continuo a ricevere "selettore non riconosciuto inviato all'istanza".iOS & Stackmob - [NSNull length]: selettore non riconosciuto inviato all'istanza
- (IBAction)save:(UIButton *)sender {
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"User"];
NSPredicate *predicte = [NSPredicate predicateWithFormat:@"username == %@", self.username];
[fetchRequest setPredicate:predicte];
[self.managedObjectContext executeFetchRequest:fetchRequest onSuccess:^(NSArray *results) {
NSManagedObject *todoObject = [results objectAtIndex:0];
[todoObject setValue:@"[email protected]" forKey:@"email"];
[self.managedObjectContext saveOnSuccess:^{
NSLog(@"You updated the todo object!");
} onFailure:^(NSError *error) {
NSLog(@"There was an error! %@", error);
}];
} onFailure:^(NSError *error) {
NSLog(@"Error fetching: %@", error);
}];
}
Ecco l'errore completo sto ottenendo:
-[NSNull length]: unrecognized selector sent to instance 0x1ec5678
2013-07-21 12:01:25.773 [29207:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[NSNull length]: unrecognized selector sent to instance 0x1ec5678'
Grazie in anticipo.
un po 'dove si ottiene il valore o l'oggetto Nil e si prova a impostare nil perché si è verificato questo errore. controlla befor setValue con it's zero o no. –
possibile duplicato di [- \ [NSNull length \]: selettore non riconosciuto inviato a ... Una perdita di memoria?] (Http://stackoverflow.com/questions/16607960/nsnull-length-unrecognized-selector-sent-to- a-memory-leak) – borrrden
Potresti stampare self.username e vedere cosa contiene? – satheeshwaran