如何正确释放NSInvocation的保留参数?

blu*_*her 3 iphone nsinvocation

在释放NSInvocation时是否释放保留的参数,还是需要手动对NSInvocation的参数列表中的对象进行释放?

Joh*_*rug 6

"保留的论点"?NSInvocation不会自动保留参数.看到:

This class does not retain the arguments for the contained invocation by default. If those 
objects might disappear between the time you create your instance of NSInvocation and the 
time you use it, you should explicitly retain the objects yourself or invoke the 
retainArguments method to have the invocation object retain them itself.
Run Code Online (Sandbox Code Playgroud)

资料来源:http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSInvocation_Class/Reference/Reference.html

使用"retainArguments"时,不必再次手动释放它们.NSInvocation通过将它们添加到自动释放池来为您执行此操作.请参阅:http://www.cocoabuilder.com/archive/cocoa/241994-surprise-nsinvocation-retainarguments-also-autoreleases-them.html