将 NSData 写入文件的最简单方法 [英] The easiest way to write NSData to a file
本文介绍了将 NSData 写入文件的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
NSData *data;
data = [self fillInSomeStrangeBytes];
我现在的问题是如何以最简单的方式将此 data
写入文件.
My question is now how I can write this data
on the easiest way to an file.
(我已经有一个 NSURL file://localhost/Users/Coding/Library/Application%20Support/App/file.strangebytes
)
(I've already an NSURL file://localhost/Users/Coding/Library/Application%20Support/App/file.strangebytes
)
推荐答案
NSData
有一个名为 writeToURL:atomically:
的方法,它完全符合您的要求.查看文档code>NSData 看看如何使用它.
NSData
has a method called writeToURL:atomically:
that does exactly what you want to do. Look in the documentation for NSData
to see how to use it.
这篇关于将 NSData 写入文件的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文