For some reason i cant set my NSNumber value.
Code is simple:
obj.objectId = [filteredArr[i] valueForKey:@"idx"];
Where [[filteredArr[i] valueForKey:@"idx"] class]
is __NSCFNumber
.
It should be a number from 0 to 200.. but it is actually -5764607523034234861
NSNumber and NSString respond to the methods -intValue which returns an int.
NSNumber *myNumber = @([[filteredArr[i] valueForKey:@"idx"]intValue]);
This may help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.