1. When uploading files to ftp using a third-party library, an error is always reported
2. Code:
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];
Total output errors: domain = 1, error = 49, errorMessage = Unknown
Among them, domain=1 is:
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 is: #define EADDRNOTAVAIL 49 / Can't assign requested address /
The local file to be uploaded is: @"/var/mobile/Containers/Data/Application/2C632403-AC9C-4250-8E43-0CC0EAC14272/Library/Caches/CrashLog/iPhone_1.0.0.0_udid_20160523163703_4.plcrash
Is there a problem with the ftp path when this error occurs? Or?
ringa_lee