XMPP传入和传出文件委托不调用

时间:2016-04-13 07:44:47

标签: ios objective-c xmpp xmppframework

我正在尝试使用XMPP实现文件传输。下面是我的代码片段。现在问题是,没有调用XMPPOutGoingFileTransfer和XMPPIncomingFileTransfer的委托方法。我挖掘出解决方案的框架但没有成功。我不知道我哪里出错了。任何类型的帮助将不胜感激。

P.S:我是iOS开发的新手:D

@interface AppDelegate ()<XMPPStreamDelegate,XMPPOutgoingFileTransferDelegate,XMPPIncomingFileTransferDelegate>{
XMPPOutgoingFileTransfer *SendFileStream;
XMPPIncomingFileTransfer *receiveFileStream;
}
@end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
SendFileStream = [[XMPPOutgoingFileTransfer alloc] init];
receiveFileStream = [[XMPPIncomingFileTransfer alloc] init];
receiveFileStream.autoAcceptFileTransfers = YES;
[SendFileStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
[receiveFileStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
return YES;
}

1 个答案:

答案 0 :(得分:0)

我认为人们不喜欢使用XMPP,或者我的问题太愚蠢了,以至于他们都懒得回答!无论出于何种原因,我都能解决我的问题,现在我有责任回答它!

我只想添加这两行代码就能实现我的目标:

[SendFileStream activate:xmppStream];
[receiveFileStream activate:xmppStream];

通过添加此代理方法将开始调用! :)