Lots of classes have versions that work with NSStrings as a filePath or NSURLs. One example:
- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error
- (BOOL)copyItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL error:(NSError **)error
Is there an /explicit/ preference to use one over the other? I’m seeking a note in the documentation on the topic.
Its really up to you. However there are a lot of things that only use URL.
You can easily go from NSURL to path. but going the other direction will require some normalization.
using a path for instance with the scheme on it already will give you an improper url.
you can however expect the path from a URL to be the correct path if initialized correctly.
therefore you can get the correct url with 3 steps
alternatively you can check the scheme to see if it is correct. but this is a problem I ran into with AVAsset because it will not load an NSURL from the path alone. It must be a fileURL
Good luck. 🙂