What would be the most elegant way to receive data from a streaming JSON API using AFNetworking? AFNetworking provides excellent support for receiving non-streaming data from JSON APIs, but I couldn't find any examples of streaming JSON.
相关问题
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
相关文章
- 现在使用swift开发ios应用好还是swift?
- json_encode 没有把数组转为json
- Livy Server: return a dataframe as JSON?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Unexpected end of JSON input from an ajax call
- Where does a host app handle NSExtensionContext#co
AFNetworking does not have a built-in streaming SAX-style JSON operation, but it should be straight forward to create your own.
AFJSONRequestOperation
outputStream
property of the operation during initialization to hook it up to a JSON parser that supports SAX-style parsing (such as Yajl). The parser will read data and build up the JSON object as it comes inresponseJSON
property to read the cached object from the parsersetReceivedJSONBlock:((^)(void (id JSON))block
). This block will probably be triggered by delegate methods sent from the parser (e.g.<YAJLParserDelegate> -parserDidEndDictionary:
).If you are able to get this working, I would encourage you to publish and share this with others. I think this could be useful to quite a few people.