Objective-C Memory Management: crash on release

前端 未结 5 1408
情深已故
情深已故 2021-01-29 00:07

I\'m new to Objective-C and can\'t seem to get the memory management code right. I have the following code:

Media* myMedia = [self.myMediaManager getNextMedia];
         


        
5条回答
  •  误落风尘
    2021-01-29 00:20

    Only objects that you own can be released.

    You can release objects if you new, alloc, copy, mutableCopy or retain them first.

    Since there is no alloc/copy/retain in [self.myMediaManager getNextMedia]; you can't release it.

提交回复
热议问题