objective-c - 第三方LxFTPRequest FTP上传 总报错
ringa_lee
ringa_lee 2017-05-02 09:24:54
0
0
897

1、采用第三方库上传文件到ftp时总报错
2、代码:

    static NSString * const FTP_ADDRESS = @"ftp://54.223.34.111:21/";
    static NSString * const USERNAME = @"123456";
    static NSString * const PASSWORD = @"123456";

    
    LxFTPRequest * request = [LxFTPRequest uploadRequest];
    request.serverURL = [[NSURL URLWithString:FTP_ADDRESS]URLByAppendingPathComponent:@"./test.txt"];
    request.localFileURL = [NSURL fileURLWithPath:fileName];
    request.username = USERNAME;
    request.password = PASSWORD;
    request.progressAction = ^(NSInteger totalSize, NSInteger finishedSize, CGFloat finishedPercent) {
        
    };
    request.successAction = ^(Class resultClass, id result) {
        NSLog(@"uploadbyftp success");
    };
    request.failAction = ^(CFStreamErrorDomain domain, NSInteger error, NSString * errorMessage) {
        NSLog(@"domain = %ld, error = %ld, errorMessage = %@", domain, error, errorMessage);    // domain = 1, error = 49, errorMessage = Unknown
    };
    [request start];

总输出错误:domain = 1, error = 49, errorMessage = Unknown
其中,domain=1为:

typedef CF_ENUM(CFIndex, CFStreamErrorDomain) {
    kCFStreamErrorDomainCustom = -1L,      /* custom to the kind of stream in question */
    kCFStreamErrorDomainPOSIX = 1,        /* POSIX errno; interpret using <sys/errno.h> */
    kCFStreamErrorDomainMacOSStatus      /* OSStatus type from Carbon APIs; interpret using <MacTypes.h> */
};

error=49为:#define EADDRNOTAVAIL 49 / Can't assign requested address /

本地待上传文件为:@"/var/mobile/Containers/Data/Application/2C632403-AC9C-4250-8E43-0CC0EAC14272/Library/Caches/CrashLog/iPhone_1.0.0.0_udid_20160523163703_4.plcrash

出现这种错误是ftp路径有问题,还是?

ringa_lee
ringa_lee

ringa_lee

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板