自己写了php文件生成的json数据格式,并且在 http://jsonlint.com/ 中测试过格式是正确的,然后用swift解析的时候如下图,info后面的值取不到,我觉得是swift解析的时候info:后面带了两个“[”的缘故,当然也可以在swift里面写循环不停读取,但我是想读取一次数据库的操作,这样应该更方便吧,配图: 在附上我的网页输出,格式没问题的
{"info":[{"name":"evermoi","locationx":"304","locationy":"406","telenum":"18931089112"},{"name":"nevertoi","locationx":"102","locationy":"203","telenum":"15861760777"},{"name":"ppmoi","locationx":"304","locationy":"809","telenum":"13761891030"},{"name":"once","locationx":"112","locationy":"223","telenum":""},{"name":"huashaofei","locationx":"214","locationy":"653.97","telenum":""},{"name":"zzz","locationx":"121","locationy":"131","telenum":""},{"name":"zzz","locationx":"121","locationy":"131","telenum":""}]}
谢谢各位大侠!