i'm new to objective-c and iOS. I'm using SimpleFTPSample to make test app for uploading and downloading files to ftp. I need to upload two files on ftp, but in SimpleFTPSample you could upload only one... so what do i need add to source code? I guess there must be some loop, but i don't know where...
Here's my code, i add for() but i know that is wrong, but i do not have any ideas. Thanks for any help.
success = (url != nil);
NSMutableArray *listFile = [[NSMutableArray alloc] initWithCapacity:2];
[listFile addObject:[[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:@"1.txt"]];
[listFile addObject:[[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:@"2.txt"]];
for (int i= 0; i <= 1; i++ ) {
self.filePath = [listFile objectAtIndex:i];
url = [NSURL URLWithString:@"ftp://anonymous@ftp"];
url = CFBridgingRelease(
CFURLCreateCopyAppendingPathComponent(NULL, (__bridge CFURLRef) url, (__bridge CFStringRef) [self.filePath lastPathComponent], false));
// );
success = (url != nil);
self.ftpFileStream = [NSInputStream inputStreamWithFileAtPath:_filePath];
assert(self.ftpFileStream != nil);
[self.ftpFileStream open];
self.ftpNetworkStream = CFBridgingRelease(
CFWriteStreamCreateWithFTPURL(NULL, (__bridge CFURLRef) url)
);
assert(self.ftpNetworkStream != nil);
self.ftpNetworkStream.delegate = self;
[self.ftpNetworkStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.ftpNetworkStream open];
}
}