开发者

What is the difference between writeToFile and writeToURL?

Maybe some one can explain that over here or send to me to right docs?

I've read the IO开发者_如何学运维S docs, and Still can't get it, when do i use the writeToURL method. Maybe The problem is with me, if every else but me understand this, but if someone can help me with that, I would be very thankful :-)


The difference is that writeToFile: needs an NSString and writeToURL: needs an NSURL. Apple recommends you use writeToURL:.

URLs can be both remote and local. You can use +[NSURL fileURLWithPath:].


"Since at present only file:// URLs are supported, there is no difference between this method and writeToFile:atomically:, except for the type of the first argument."

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/#//apple_ref/occ/instm/NSData/writeToURL:atomically:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜