objective c parse json from url request

前端 未结 7 1144
醉酒成梦
醉酒成梦 2021-02-06 00:14

I am trying to parse a json string requested from an api located at: http://www.physics.leidenuniv.nl/json/news.php

However, i am having trouble parsing this json. I get

相关标签:
7条回答
  • 2021-02-06 00:46

    One solution is to use NSURLConnection sendSynchronousRequest:returningResponse:error: (docs). In the completion handler you'll have ALL the response data, not just the partial data you get in the delegate's connection:didReceiveData: method.

    If you want to keep using the delegate, you'll need to follow the advice in the Apple docs:

    The delegate should concatenate the contents of each data object delivered to build up the complete data for a URL load.

    0 讨论(0)
提交回复
热议问题