我使用的是 httputil 发请求,它给我回的是一段 json 字符串,我用 android5.0.2 的手机调试时,能正确返回 json 字符串,格式如下 :
{"desc":"OK","status":1000,"data":{"wendu":"21","ganmao":"天气转凉,空气湿度较大,较易发生感冒,体质较弱的朋友请注意适当防护。","forecast":[{"fengxiang":"东风","fengli":"3-4 级","high":"高温 24℃","type":"小雨","low":"低温 18℃","date":"6 日星期二"},{"fengxiang":"东南风","fengli":"4-5 级","high":"高温 23℃","type":"小雨","low":"低温 16℃","date":"7 日星期三"},{"fengxiang":"东北风","fengli":"微风级","high":"高温 22℃","type":"小雨","low":"低温 14℃","date":"8 日星期四"},{"fengxiang":"西风","fengli":"微风级","high":"高温 21℃","type":"晴","low":"低温 13℃","date":"9 日星期五"},{"fengxiang":"西北风","fengli":"3-4 级","high":"高温 19℃","type":"多云","low":"低温 12℃","date":"10 日星期六"}],"yesterday":{"fl":"微风","fx":"东风","high":"高温 22℃","type":"小雨","low":"低温 18℃","date":"5 日星期一"},"city":"马鞍山"}}
但是使用另一个 android4.0.3 的手机调试时,却得不到 json 字符串,返回如下:
{"desc":"invilad-citykey","status":1002}
我在 AndroidManifest.xml 文件中设置的是
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="22"
/>
不知道怎么回事,希望遇到类似情形的前辈指导,不胜感激。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.