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);
}
}
我在哪裏做錯了?感謝您的幫助