0

I am having a slight code problem. I have an array but when I pull data out of it, I need it in the form of an int. To do this, I tried to use:

int main_id = [[courses valueForKey:@"id"] intValue];

but this gives me the error:

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:   '-[__NSArrayI intValue]: unrecognized selector sent to instance 0x6b438d0'
*** First throw call stack:
(0x16ac022 0x183dcd6 0x16adcbd 0x1612ed0 0x1612cb2 0x4bf8 0x4fdd 0xdea1e 0xddfec 0x104f1d 0xef1cb 0x105df1 0x105e0d 0x105ea9 0x446f5 0x4473c 0x15596 0x16274 0x25183 0x25c38 0x19634 0x1596ef5 0x1680195 0x15e4ff2 0x15e38da 0x15e2d84 0x15e2c9b 0x15c65 0x17626 0x36ed 0x2695 0x1)
terminate called throwing an exception
4
  • How are you storing the data within the NSDictionary? Commented Jun 1, 2012 at 12:20
  • I am actually storing the data in the form of an NSArray but I am using Keys in the array. Commented Jun 1, 2012 at 12:23
  • 1
    The compiler complains that you're calling intValue on an instance of NSArray. What object do you want to your intValue from? Commented Jun 1, 2012 at 12:25
  • OK then, how are you storing the data within the NSArray within the NSDictionary? Commented Jun 1, 2012 at 12:26

1 Answer 1

2

I have found the answer. I was using an NSArray

NSArray *array;

That had another nsarray in it. I was trying to call the intvalue of a NSArray.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.