Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 需要有关使用xep-0184的帮助吗_Objective C_Ios_Xmpp_Xmppframework - Fatal编程技术网

Objective c 需要有关使用xep-0184的帮助吗

Objective c 需要有关使用xep-0184的帮助吗,objective-c,ios,xmpp,xmppframework,Objective C,Ios,Xmpp,Xmppframework,我正在为我当前的项目使用,我可以发送和接收消息给我花名册中的人,但现在我必须实现消息传递状态。我知道xep its 0184,我也将其包括在我的项目中,我很难使用它 我在中读到,请求元素也必须包含在消息中,所以下面是我的代码: #import "XMPPMessage+XEP_0184.h" . . . NSXMLElement *body = [NSXMLElement elementWithName:@"body"]; [body setStringValue:messageStr];

我正在为我当前的项目使用,我可以发送和接收消息给我花名册中的人,但现在我必须实现消息传递状态。我知道xep its 0184,我也将其包括在我的项目中,我很难使用它

我在中读到,请求元素也必须包含在消息中,所以下面是我的代码:

#import "XMPPMessage+XEP_0184.h"
.
.
.
NSXMLElement *body = [NSXMLElement elementWithName:@"body"];

[body setStringValue:messageStr];

NSXMLElement *request = [NSXMLElement elementWithName:@"request" xmlns:@"urn:xmpp:receipts"];

NSXMLElement *message = [NSXMLElement elementWithName:@"message"];

[message addAttributeWithName:@"type" stringValue:@"chat"];

[message addAttributeWithName:@"to" stringValue:[defaults objectForKey:@"chatWith"]]; 
[message addChild:body];
[message addChild:request];
.
.
.
XMPPMessage *xm = [[XMPPMessage alloc]init];
NSLog(@"..1..%d",[xm hasReceiptRequest]);        // Result = 0
NSLog(@"..2..%d",[xm hasReceiptResponse]);       // Result = 0
NSLog(@"..3..%@",[xm extractReceiptResponseID]); // Result = (null)
NSLog(@"..4..%@",[xm generateReceiptResponse]);  // Result = <message><received xmlns="urn:xmpp:receipts"></received></message>
#导入“XMPPMessage+XEP_0184.h”
.
.
.
NSXMLElement*body=[NSXMLElement elementWithName:@“body”];
[正文设置字符串值:messageStr];
NSXMLElement*request=[NSXMLElement elementWithName:@“request”xmlns:@“urn:xmpp:receives”];
NSXMLElement*消息=[NSXMLElement元素名称:@“消息”];
[消息addAttributeWithName:@“type”stringValue:@“chat”];
[消息addAttributeWithName:@“to”stringValue:[默认值objectForKey:@“chatWith”];
[消息addChild:body];
[消息addChild:request];
.
.
.
XMPPMessage*xm=[[XMPPMessage alloc]init];
NSLog(@“.1..%d”,[xm hasReceiptRequest]);//结果=0
NSLog(@“.2..%d”,[xm hasReceiptResponse]);//结果=0
NSLog(@“.3..%@,[xm extractReceiptResponseID]);//结果=(空)
NSLog(@“.4..%@”,[xm generateReceiptResponse]);//结果=

请帮助我如何获取消息传递状态。

我想您忘记添加模块本身了。 当您想要添加像XMPPMessageDeliveryReceipts这样的XMPPModule时,应该首先将其添加到XMPPStream对象中,然后才能使用其函数

请执行以下操作:

// Setup Message Delivery Recipts Object
XMPPMessageDeliveryReceipts* xmppMessageDeliveryRecipts = [[XMPPMessageDeliveryReceipts alloc] initWithDispatchQueue:dispatch_get_main_queue()];
xmppMessageDeliveryRecipts.autoSendMessageDeliveryReceipts = YES;
xmppMessageDeliveryRecipts.autoSendMessageDeliveryRequests = YES;

[xmppMessageDeliveryRecipts activate:xmppStream];
当xmppStream是主要的XMPPFramework对象时


希望我能帮上忙。

可能的副本您能详细解释一下吗。因为即使我们在XMPP流上实现了传递通知,我们也无法接收任何通知。请分享更多关于发货通知的信息,请看这里-这可能会对您有所帮助。