Hi,
We are successfully able to parse the OData service returing response in XML using the SMP3.0 OData Mobile SDK with following snippet of parsing logic.
We need to parse the OData Service in JSON format.We are successfully able to get Service and MetaData documents. After that, when we try to parse OData service returning response in JSON.
Below code is throwing exception.
Service Used: http://services.odata.org/v2/Odata/Odata.svc/Products?$format=json
Code Snippet:
@try {
ODataCollection *collc = [[self.serviceDocumentgetSchema] getCollectionByName:_srvcInfo.serviceEntityName];
ODataEntitySchema *schema = [collc getEntitySchema];
//Instantiate parser for Carrier entity
ODataDataParser *dataParser=[[ODataDataParseralloc] initWithEntitySchema:schemaandServiceDocument:self.serviceDocument];
//Parses a feed or an entry xml or json
[dataParser parse:entriesData];
results = dataParser.entries;
}
@catch(NSException *e) {
NSLog(@"Exception:%@, %@", e.description, e.debugDescription);
}
Exception:
-[__NSCFArray objectForKey:]: unrecognized selector sent to instance
However Service Used:http://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json. Not
throwing any exception, but dataParser.entries is returning 0 objects
Please let us know, is the same API is used for parsing JSON.
What can be the reason of issue and what are possible resolution.
Thanks,
Parveen.