Swift simple request

60 views
Skip to first unread message

Hiro

unread,
Jan 6, 2015, 2:56:42 AM1/6/15
to res...@googlegroups.com
Hi, I get this code


With this kind of json : 

{"sales":[
 
{"id":1,"title":"Montres"},
 
{"id":2,"title":"Brand"},
 
{"id":3,"title":"Montres 2 (z201)"},
 
{"id":4,"title":"Marché de Noël"},
 
{"id":5,"title":"Parc"}]
}

If I launch this code I get exception with error

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<project.Sale 0x7fd8f8504ba0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key id.'

But I don't know why

Mihai Timar

unread,
Jan 27, 2015, 11:58:43 AM1/27/15
to res...@googlegroups.com
This looks like you Sale class does not have a settable property named id (also that would be a terrible property name in objc), or that property is not compatible with numbers (although i think that would generate some other error).

How does you Sale class look like? Can you make it KVC compliant for the key id? Or choose another key for so it looks nicer in objc
Reply all
Reply to author
Forward
0 new messages