iOS: Converting id to int
casting, ios, type-conversion
Solution
int taskNo = (int)[tasks indexOfObject:@"something"];
Problem
I have troubles converting id of an object to int (or NSINteger), so that I can use it in a loop later. Here is the case: ``` // "tasks" is a mutable array int taskNo = [[tasks indexOfObject:@"something"] integerValue]; ``` But it results in: ``` Bad receiver type 'NSUInteger' (aka 'unsigned int') ``` I found a similar thread with code similar to what I have above, but unfortunately it didn't work for me. I guess I must be missing something simple. Thanks a lot!