Why does ARC retain method arguments?

后端 未结 4 1524
再見小時候
再見小時候 2020-11-29 07:48

When compiling with ARC, method arguments often appear to be retained at the beginning of the method and released at the end. This retain/release pair seems superfluous, and

4条回答
  •  一生所求
    2020-11-29 07:54

    Passing as a parameter does not, in general, increase the retain count. However, if you're passing it to something like NSThread, it is specifically documented that it will retain the parameter for the new thread.

    So without an example of how you're intending to start this new thread, I can't give a definitive answer. In general, though, you should be fine.

提交回复
热议问题