Objc 使用 URL 将文件保存到 tmp/它不起作用 [英] Objc save a file to the tmp/ with URL it is not working
本文介绍了Objc 使用 URL 将文件保存到 tmp/它不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我做以下它工作正常
if i do the following it works fine
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:[response suggestedFilename]];
但是如果我尝试使用 URL 保存它(尽管它返回正确的路径),它不会保存它.
But if i try to save it using the URL (although it returns the correct path) it does not save it.
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[response URL] absoluteString]];
有什么想法吗?
推荐答案
对于系统文件路径不要使用
For a system file path don't use
[[response URL] absoluteString]
因为字符串以方案file://
使用
[[response URL] path]
相反,它以 /
但我怀疑将完整路径附加到临时目录是否是您想要的.
But I doubt that appending the full path to the temporary directory is what you want.
这篇关于Objc 使用 URL 将文件保存到 tmp/它不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文