What is the difference between writeToFile and writeToURL?

Can someone explain this here or send me the right documents?

I read IOS docs and still can't get it when I use the writeToURL method. Maybe the problem is with me, if everyone except me understands this, but if someone can help me, I would be very grateful :-)

+6
source share
2 answers

The difference is that writeToFile: requires NSString and writeToURL: requires NSURL. Apple recommends using writeToURL :.

URLs can be either remote or local. You can use + [NSURL fileURLWithPath:].

+6
source

"Since only: // URLs are currently 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 :

+1
source

Source: https://habr.com/ru/post/893154/


All Articles