我这样尝试:
XMPPRosterMemoryStorage *xmppRosterMemStorage = [[XMPPRosterMemoryStorage alloc] init];
XMPPRoster *xmppRoster = [[XMPPRoster alloc] initWithRosterStorage:xmppRosterMemStorage
dispatchQueue:dispatch_get_main_queue()];
[xmppRoster addDelegate:self delegateQueue:dispatch_get_main_queue()];
xmppRoster.autoAcceptKnownPresenceSubscriptionRequests = true;
xmppRoster.autoFetchRoster = true;
[xmppRoster activate:xmppStream];
[xmppRoster fetchRoster];
但是
xmppRoster
为空。为什么? 最佳答案
名册项目存储在[xmppRosterMemStorage mainThreadManagedObjectContext]
中,您可以将其与NSFetchedResultsController
用作UITableView
的数据源,请参阅XMPPFramework源中的iPhoneXMPP示例