I’m literally going crazy whit these six rows of code.
NB: nome and prezzo are 2 textFields
NSString *itemName = (NSString *) [rowVals objectForKey:@"name"];
NSString *itemPrice = (NSString *) [rowVals objectForKey:@"price"];
nome.text = itemName;
nome.userInteractionEnabled = YES;
prezzo.text = itemPrice;
prezzo.userInteractionEnabled = YES;
Don’t know why when itemPrice is copied in one of those label, the program go in SIGABRT.
Instead if I try to read the content with an NSLog(@"%@",itemPrice); it return the exact value, so it means that is a valid NSString.
The only solution I found is passing through a NSNumber:
NSNumber *itemPrice = (NSNumber *) [rowVals objectForKey:@"price"];
prezzo.text = [[NSString alloc] initWithFormat:@"%@", itemPrice];
There is another way to use directly the NSString?
Probably the value in the @”price” field is NSNumber, and not an NSString. The NSLog method will still provide a correct result, since %@ is used for any NSObject subclass, not just NSString.