I fetched History from openfire by installing open fire plugin in the open fire and tried this code.
let iq1 = DDXMLElement(name: \"iq\")
iq1.addAttribut
I have implemented the same to get the Message to and from by sending the given iq And I am getting the proper result.
let iQ = DDXMLElement.element(withName: "iq") as! DDXMLElement
iQ.addAttribute(withName: "type", stringValue: "get")
iQ.addAttribute(withName: "id", stringValue: (xmppHandler.xmppStream?.generateUUID())!)
let retrieve = DDXMLElement(name: "retrieve", xmlns: "urn:xmpp:archive")
retrieve?.addAttribute(withName: "with", stringValue: "\(JID!)@\(Utility.hostname)")
let set = DDXMLElement.element(withName: "set") as! DDXMLElement
set.addAttribute(withName: "xmlns", stringValue: "http://jabber.org/protocol/rsm")
let max = DDXMLElement.element(withName: "max") as! DDXMLElement
max.stringValue = "10"
max.addAttribute(withName:"xmlns", stringValue: "http://jabber.org/protocol/rsm")
iQ.addChild(retrieve!)
retrieve?.addChild(set)
set.addChild(max as DDXMLNode)
xmppHandler.xmppStream?.send(iQ)
<iq type="get" id="7705EEC5-3385-42D4-B748-B39C204ADB90"><retrieve xmlns="urn:xmpp:archive" with="0544008296@192.168.2.181"><set xmlns="http://jabber.org/protocol/rsm"><max xmlns="http://jabber.org/protocol/rsm">10</max></set></retrieve></iq>
Response
<iq xmlns="jabber:client" type="result" id="7705EEC5-3385-42D4-B748-B39C204ADB90" to="0509503847@192.168.2.181/Smack">
<chat xmlns="urn:xmpp:archive" with="0544008296@192.168.2.181" start="2017-02-28T09:55:27.068Z">
<from secs="0" jid="0544008296@192.168.2.181">
<body>Hiii rajeev</body>
</from>
<to secs="52">
<body>Hi
How r u</body>
</to>
<from secs="15" jid="0544008296@192.168.2.181"><body>I am good</body></from>
<to secs="8"><body>What abt u</body></to>
<to secs="169"><body>Hello testing chat</body></to>
<from secs="10" jid="0544008296@192.168.2.181"><body>Good</body></from>
<from secs="5" jid="0544008296@192.168.2.181"><body>Continue </body></from>
<to secs="834"><body>Ok
</body></to>
<to secs="8"><body>Nice chat
</body></to>
<from secs="232" jid="0544008296@192.168.2.181"><body>Heelo</body></from>
<set xmlns="http://jabber.org/protocol/rsm"><first index="0">0</first> <last>9</last><count>574</count></set></chat></iq>