我正在开发聊天应用程序。我想屏蔽朋友。我正在使用 xmpp 框架的 XEP-0016 扩展。
这是我的代码..
- (void)setupXMPPPrivacy
{
NSLog((@"%s [Line %d] "), __PRETTY_FUNCTION__, __LINE__);
//Init XMPPPrivacy List
//xmppPrivacy = [[XMPPPrivacy alloc] init];
xmppPrivacy = [[XMPPPrivacy alloc] initWithDispatchQueue:dispatch_get_main_queue()];
//Activate xmpp modules
[xmppPrivacy activate:xmppStream];
//Delegate XMPPPrivacy
[xmppPrivacy addDelegate:self delegateQueue:dispatch_get_main_queue()];
}
- (void)privacyBlock:(XMPPJID *)jid
{
NSXMLElement *privacyElement = [XMPPPrivacy privacyItemWithType:@"jid" value:jid.bare action:@"deny" order:1];
[XMPPPrivacy blockIQs:privacyElement];
[XMPPPrivacy blockMessages:privacyElement];
[XMPPPrivacy blockPresenceIn:privacyElement];
[XMPPPrivacy blockPresenceOut:privacyElement];
NSLog(@"-------> PRIVACY ELEMENT: %@", privacyElement);
NSArray *arrayPrivacy = [[NSArray alloc] initWithObjects:privacyElement, nil];
[xmppPrivacy setListWithName:@"public" items:arrayPrivacy];
}
但是,这是行不通的。我究竟做错了什么?
请帮忙。谢谢。