iOS编程:在XML中发布JSON
我有一个api响应,如下所示:iOS编程:在XML中发布JSON,xml,ios,json,asihttprequest,Xml,Ios,Json,Asihttprequest,我有一个api响应,如下所示: <root> <child> <otherKey>Some Object</otherKey> <notification>{"messages":1,"request":1}</notification> </child> </root> NSString *notification = [NSString stringWithFormat:@
<root>
<child>
<otherKey>Some Object</otherKey>
<notification>{"messages":1,"request":1}</notification>
</child>
</root>
NSString *notification = [NSString stringWithFormat:@"{\"messages\":%d,\"request\":%d}", shallNotifyMessage, shallNotifyRequests];
但当我像这样更新通知时:
<root>
<child>
<otherKey>Some Object</otherKey>
<notification>{"messages":1,"request":1}</notification>
</child>
</root>
NSString *notification = [NSString stringWithFormat:@"{\"messages\":%d,\"request\":%d}", shallNotifyMessage, shallNotifyRequests];
下次我查询时,它会给我这个响应:
<notification>{&quot;messages&quot;:1,&quot;request&quot;:1}</notification>
1.解析XML并提取JSON字符串,然后解析JSON。2.无法根据API响应来确定这一点。服务器需要什么样的请求,您需要向其发送什么数据?@aroth,我编辑了我的问题,忘记了解析,只将其更改为发布,谢谢:D