Since you want only digits, use an NSCharacterSet
that describes that, along with scanCharactersFromSet:intoString:
// Don't create this more than once if possible.
NSCharacterSet * decimalCharSet = [NSCharacterSet decimalDigitCharacterSet];
//...
[scanner scanCharactersFromSet:decimalCharSet
intoString:&temp1];