2012-05-18 86 views
1

我用SimpleFTPSample上傳文件,但我有問題,線:上傳文件到FTP - iOS設備

ftpStream = CFWriteStreamCreateWithFTPURL(NULL, (__bridge CFURLRef) urlOfHost); 
     assert(ftpStream != NULL); 

它總是NULL,我不知道爲什麼? hostUrl是好的,但沒有發生ftpStream,我得到斷言。

網址:

urlOfHost = [[AppDelegate sharedAppDelegate] smartURLForString:[NSString stringWithFormat: @"ftp://wd150.1host.co.il/%@", orderKey]]; 

    success = (urlOfHost != nil); 

    if (success) { 
     // Add the last part of the file name to the end of the URL to form the final 
     // URL that we're going to put to. 

     urlOfHost = CFBridgingRelease(CFURLCreateCopyAppendingPathComponent(NULL, (__bridge CFURLRef) url, (__bridge CFStringRef) [filePath lastPathComponent], false) 
           ); 
     NSLog (@"%@", [urlOfHost description]); 
     success = (urlOfHost != nil); 
    } 

有人能知道嗎?

從預先感謝。

+0

向我們展示如何創建你的'urlOfHost'。 – trojanfoe

+0

我編輯我的問題。謝謝 – Segev

回答

0

你是否在PutController中添加了這個藥水給你的遷移程序。以下將解決simpeFTPsample「文件讀取錯誤」

@implementation PutController{  
    uint8_t _buffer[kSendBufferSize];  
}   
-(uint8_t *)buffer{   
return self->_buffer;  
} 

如果您沒有在您的程序中插入此部分。

bytesRead = [self.fileStream read:self.buffer maxLength:kSendBufferSize];