3

The sudzc generated stub is:

(void)HandleSearchResult: (id) value { ...

The document indicates that "value" can be cast into (SDZSearchItemsByUpcResponse *). However that was not true.

In XCode, the type of "value" appears to be __NSCFDictionary.

勿绮语
  • 9,170
  • 1
  • 29
  • 37

1 Answers1

3

__NSCFDictionary is a concrete subclass of either NSDictionary or NSMutableDictionary. Handle like so:

-(void)handleSearchResult:(id)value {
    NSDictionary* dict = value;
    NSLog(@"value is: %@", dict);
    // Do what you want with your dictionary
}

I would skip SudzC and use CWXMLTranslator from https://github.com/jayway/CWFoundation. It allows you to ignore most of the cruft in SOAP XML responses, and translates directly to proper domain objects, not dictionaries and other placeholders.

PeyloW
  • 36,742
  • 12
  • 80
  • 99
  • dear PeyloW, Can you please provide more info about why to skip SudzC and use CWXMLTranslator ? I tried to contact you but didnt find any email or ID . thanks in advance. – Milad Rezazadeh Aug 17 '12 at 07:34
  • @MiladRk I say the best explanation as to why you should use CWXMLTranslator is in this repo https://github.com/PeyloW/CWFoundation, it has a sample RSS feed parser in 9 lines of SDL. If there is an easier way to handle XML then I would like to know about it. – PeyloW Aug 31 '12 at 07:27