将文件写入安全服务器
我正在尝试将文本文件写入安全服务器............
-(IBAction) startUpload{
NSLog(@"Start upload");
NSString *myString = @"TESTTEXT";
NSURL *myURL = [NSURL URLWithString:@"ftp://USERNAME:[email protected]/testfile.plist"];
NSError *error;
BOOL ok = [myString writeToURL:myURL atomically:NO encoding:NSUTF8StringEncoding error:&error];
if (!ok) { // if NOT ok
NSLog(@"error writing to file at %@, %@, %@",myURL,[error localizedFailureReason],[error localizedDescription]);
}
}
我得到的只是此错误消息......
写入文件时出错 ftp://用户名:[电子邮件受保护]/testfile.plist,(空),操作无法完成。 (Cocoa 错误 518。)
感谢所有帮助
I'm trying to write a text file to a secure server .....
-(IBAction) startUpload{
NSLog(@"Start upload");
NSString *myString = @"TESTTEXT";
NSURL *myURL = [NSURL URLWithString:@"ftp://USERNAME:[email protected]/testfile.plist"];
NSError *error;
BOOL ok = [myString writeToURL:myURL atomically:NO encoding:NSUTF8StringEncoding error:&error];
if (!ok) { // if NOT ok
NSLog(@"error writing to file at %@, %@, %@",myURL,[error localizedFailureReason],[error localizedDescription]);
}
}
... and all I get is this error message ....
error writing to file at ftp://USERNAME:[email protected]/testfile.plist, (null), The operation couldn’t be completed. (Cocoa error 518.)
All help appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为 FTP 不支持 NSURL,
看看这个问题: NSURL 与 http:// 工作正常,但与 ftp:// 则不行
也看看这个
使用 iPhone 应用程序将照片上传到任意 FTP
I think FTP is not supported as NSURL,
take a look to this question: NSURL with http:// works fine but with ftp:// not
also take a look to this one
Upload photo to arbitrary FTP with iPhone app
查看 s7ftprequest
说明:
Have a look at s7ftprequest
Description: