2012-05-18 83 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];