2015-02-06 86 views
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); 
} 

}

我在哪裏做錯了?感謝您的幫助

回答

1

對於發送文件從iPhone到iPhone,你必須上傳圖像或文件到特定的服務器,併成功上傳後,你必須發送上傳的文件的URL到另一個iPhone用戶。以便第二個用戶可以從該特定的URL下載文件。