Jack Amoratis
Jack Amoratis

Reputation: 672

iOS Cocoa NSArrayI length]: unrecognized selector sent to instance

I am trying to determine what is causing this error:

2014-06-08 20:40:44.076 Database[8656:70b] -[__NSArrayI length]: unrecognized selector sent to instance 0x8a44050

Here is the code.

NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&error];

This is the breaking point where the error occurs: NSLog([json allKeys]);

SAMPLE OF THE JSON BEING USED AS INPUT:

{"1":{"key":"1","contentONE":"aaa","contentTWO":"testing"},"2":{"key":"2","contentONE":"bbb","contentTWO":null},"3":{"key":"3","contentONE":"ccc","contentTWO":"testing"}}

Upvotes: 0

Views: 1042

Answers (1)

Rengers
Rengers

Reputation: 15228

[json allKeys] returns an NSArray, while NSLog expects a formatting string. Try this:

NSLog(@"%@", [json allKeys]);

Upvotes: 3

Related Questions