Open stream error in SimpleFTPSample provided in Apple documentation

前端 未结 3 474
借酒劲吻你
借酒劲吻你 2021-01-14 08:56

I want to upload images to server through ftp.

I found a SimpleFTPSample in apple documentation, and downloaded it.

When running the app(I\'m using xcode 4.5

3条回答
  •  深忆病人
    2021-01-14 09:23

    Adding this line before setting the networkStream delegate in PutController.m StartSend fixed the problem for me:

    [self.networkStream setProperty:(id)kCFBooleanFalse forKey:(id)kCFStreamPropertyFTPUsePassiveMode];
    

    Without the above line (or with the property set to kCFBooleanTrue instead of kCFBooleanFalse), I consistently got Stream Open Error. I only tried with one FTP server, but it doesn't seem to support passive mode which is apparently the default.

提交回复
热议问题