我覺得冠軍是說明就夠了,但這裏的故事:XMPPFramework - 自動接受狀態訂閱的請求
我是新來XMPPFramework
爲iOS和我想設置我的客戶端自動接受任何預訂請求它收到。以便其他客戶可以在他們請求時看到此客戶的在線狀態。
根據開發者的意見在XMPPRoster.h
文件,有這種方法中,接收訂閱請求時被調用:
/**
* Sent when a presence subscription request is received.
* That is, another user has added you to their roster,
* and is requesting permission to receive presence broadcasts that you send.
*
* The entire presence packet is provided for proper extensibility.
* You can use [presence from] to get the JID of the user who sent the request.
*
* The methods acceptPresenceSubscriptionRequestFrom: and rejectPresenceSubscriptionRequestFrom: can
* be used to respond to the request.
**/
- (void)xmppRoster:(XMPPRoster *)sender didReceivePresenceSubscriptionRequest:(XMPPPresence *)presence;
但它不是在XMPPRoster.m
實現。所以我實現它如下:
- (void)xmppRoster:(XMPPRoster *)sender didReceivePresenceSubscriptionRequest:(XMPPPresence *)presence
{
[self acceptPresenceSubscriptionRequestFrom:[presence from] andAddToRoster:YES];
}
由於我是新來XMPPFramework我不知道如果我做錯了什麼,但我還是不能讓該客戶在其他客戶端存在。
我也看過類似的主題,如Accept buddy request in xmpp client iphone或Xmpp Accepting buddy request,但解決方案似乎甚至沒有關聯!
任何建議真的很感激。 謝謝。
你試過用'revokePresencePermissionFromUser'嗎? –
不!我應該嗎?我應該怎麼做?我是新來的XMPPFramework –
而不是acceptPresence只是嘗試revokePresencePermissionFromUser,看看它是否工作 –