objective c - Am I creating a retain cycle between UIViewController and a custom object? -


in project using arc, have uiviewcontroller handling many concerns, i'm looking split things up. 1 obvious thing me take out method formats , sends email, , split separate object.

my controller handles mfmailcomposeviewcontrollerdelegate protocol because, after email sent, have additional work do.

my question is, if controller uses separate object emailing, , give pointer controller use mfmailcomposeviewcontroller mailcomposedelegate, going create problem -- retain cycle?

if so, better approach in scenario? enough set property pointing controller weak?

as suggested in question, avoid retain cycle need make helper object's mailcomposedelegate property weak property.

@interface myviewcontroller : uiviewconroller @property(nonatomic, strong) myhelperemailobjectclass *emailhelper; @end  @interface myhelperemailobjectclass : nsobject     @property(nonatomic, weak) id<mfmailcomposeviewcontrollerdelegate> mailcomposedelegate; @end 

you retain cycle if objects had eachother assigned strong properties.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -