iOS JSON Error: NSDebugDescription=Garbage at end

前端 未结 5 842
有刺的猬
有刺的猬 2020-12-21 07:52

This is a really weird bug, when grabbing JSON from my server (which is produced via PHP), I get this error when calling:

json = [NSJSONSerialization JSONObj         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-21 08:57

    I was able to solve the same problem (works on wifi, but not on carrier network) by sending a content-length header just before the response:

    header("Content-length: ".strlen($response));
    echo $response;
    exit;
    

提交回复
热议问题