简体   繁体   中英

NSNumber from array

I have an array, and I am trying to get an integer in my array into a int or NSInteger. It uses NSDictionaries. The following code does not work:

int color = [[records objectAtIndex:0] valueForKey: @"color"];

Note that I am using a Core Data Fetch that saves into an array called "records".

Thanks

尝试这个:

int color = [[[records objectAtIndex:0] valueForKey: @"color"] intValue];

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM