I am attempting to consume a REST service in an iOS app. I am using Overcoat.
In my OVCHTTPRequestOperationManager
subclass I have the following:
+ (NSDictionary *)modelClassesByResourcePath {
return @{
@"users/*" : [SCUser class],
@"user/*" : [SCUser class],
@"card/*" : [SCCreditCard class],
@"cards*" : [SCCreditCard class]
};
}
+ (NSDictionary *)responseClassesByResourcePath{
return @{
@"cards" : [SCCardResponse class]
};
}
I want to serialize a JSON payload like this:
{
"total": 2,
"cards": [
{
"balance": 1000.0,
"ownerName": "Test One",
},
{
"balance": 100.0,
"ownerName": "Test Two",
},
...
}
So far all is good, but when I try to get the cards from the response object, I get an array of NSDictionary
objects, and not an array of SCCreditCard
objects.
Has anyone had this? How to solve it?
I've solved it, there was an extra
*
in themodelClassesByResourcePath
method:All working now.