NSFileManager has a method to do copying.
- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error
If an error occurs, the third parameter (NSError **) upon return will contain an NSError object describing the problem.
Question: do I need to release it?
There are some other methods, for example this one takes (NSString **),
NSPropertyListSerialization +(NSData *)dataFromPropertyList:(id)plist format:(NSPropertyListFormat)format errorDescription:(NSString **)errorString
do they follow the same memory management rules? To release or not to, that's the question.
As Anders said, the answer is "not" to release.
I got confused because the class NSPropertyListSerialization has a method
+ (NSData *)dataFromPropertyList:(id)plist format:(NSPropertyListFormat)format errorDescription:(NSString **)errorString
the document says that I should release the third argument if not nil. However it's deprecated and replaced by
+ (NSData *)dataWithPropertyList:(id)plist format:(NSPropertyListFormat)format options:(NSPropertyListWriteOptions)opt error:(NSError **)error
and the argument is (NSError **) now. No need to release as other similiar methods. So the general memory manegement rule is no need to release this kind of arguments.