I am trying to download a file from an FTP server using an NSOperation. My base example for the download is Apple’s Simple FTP project. In particular, I am using the code from the GetController class. The URL that I am trying to download works fine from there.
In my NSOperation subclass, I override the start method and call the _startRecieve method found in GetController. The NSStream delegate is getting called, but the event is NSStreamEventErrorOccurred.
I investigated the error a bit, and it is kCFErrorDomainCFNetwork error 200, which is kCFFTPErrorUnexpectedStatusCode.
Since the code _startRecieve code is identical, the only problem that I can think of would be the fact that it is contained in an NSOperation. The only thing that looks like it could have problems with an operation _startRecieve is this.
self.networkStream.delegate = self;
[self.networkStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.networkStream open];
Any ideas why this is not working?
Thanks,
Ross
Instead of rolling your own NSOperation subclass for networking, why not use QHTTPOperation from Apple’s MVCNetworking project?