Memory leak problem and i need help #1

前端 未结 5 709
北海茫月
北海茫月 2021-01-23 08:34

I am very new at this and seems to have a leak in this piece of code that i cannot fix:

The Instruments shows on this line with a 100%:

NSMutableA

5条回答
  •  长情又很酷
    2021-01-23 09:09

    I am assuming you set the property managedObjectContext to "retain". Change the line to this (include "self" so that it gets retained):

    if (self.managedObjectContext == nil) { self.managedObjectContext = [(FamQuiz_R0_1AppDelegate *)
                                                           [[UIApplication sharedApplication] delegate] managedObjectContext]; }
    

    Then add your release back in.

提交回复
热议问题