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

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

Antworte allen(0)
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage