Find where object is retained with ARC

后端 未结 5 1471
逝去的感伤
逝去的感伤 2020-12-07 12:03

I have an object that is being retained more than necessary (most likely due to a property that is strong instead of weak). Big codebase, so it\'s

5条回答
  •  离开以前
    2020-12-07 13:10

    If you are using ARC you would never get the option to add retain,

    secreenshot1

    and if you have converted the project to ARC using below option, you would be prompted with error

    screenshot2

    If you have set the property as strong, then you should allocate the object once through the whole project e.g. self.yourobject = [[NSMutableArray alloc]init];. There is no shortcut for this.

提交回复
热议问题