0
我设法从iphone成功发送文件到spark。 现在我想发送一个文件从iPhone到iPhone,不幸的是我总是得到这个错误代码: 打印错误描述: 错误域= XMPPOutgoingFileTransferErrorDomain代码= -1“无法发送SI提供;收件人没有所需的功能“。 UserInfo = {0x1a9773d0 NSLocalizedDescription =无法发送SI报价;收件人不具有所需功能}XMPP框架发送文件
的代码我使用的转让和以下内容:
- (无效){elaborazioneInvioTraferimentoFile
XMPPOutgoingFileTransfer *xmppIncomingFileTransfer= [XMPPOutgoingFileTransfer new];
[xmppIncomingFileTransfer activate:self.xmppStream];
[xmppIncomingFileTransfer addDelegate:self delegateQueue:dispatch_get_main_queue()];
UIImage *img=[UIImage imageNamed:@"ico.png"];
NSData *pngData = UIImagePNGRepresentation(img);
NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths1 objectAtIndex:0]; //Get the docs directory
NSString *filePath = [documentsPath stringByAppendingPathComponent:@"ico.png"]; //Add the file name
[pngData writeToFile:filePath atomically:YES]; //Write the file
// do error checking fun stuxmppIncomingFileTransferff...
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *fullPath = [[paths lastObject] stringByAppendingPathComponent:@"ico.png"];
NSData *data = [NSData dataWithContentsOfFile:fullPath];
NSLog(@"******%@",self.senderId);
NSError *err;
if (![xmppIncomingFileTransfer sendData:data
named:@"ico.png"
toRecipient:[XMPPJID jidWithString:self.senderId]
description:@"Baal's Soulstone, obviously."
error:&err]) {
DDLogInfo(@"You messed something up: %@", err);
}
}
我在哪里做错了?感谢您的帮助