The two classes are only slightly related. The first function you use is the convenience method, which almost certainly uses the NSFileManager in the background. Otherwise, however, NSData has many purposes not related to files.
Which of the two you use depends on your intentions. If you want to read the contents of a file, you are likely to use the first one. If you want to delete the file, if it exists, you will definitely use the second one.
source share