1

Well I have Just started digging about memory management concepts in iOS.

I know what are strong , weak , assign ... so on.

But I am confused in two things:

  1. When should I use Strong and When I use Weak
  2. When using weak will create problem.

Suppose I have a Class.

ViewController.h

  @property (weak) NSString *myString;

Now I want to know whether at some point it will create any problem ? If Yes then How and when ?

  • I am not asking about the difference between them.. That I know..I want to know the practical use and effects that is clear from my question i think @jlehr – user5214391 Sep 04 '15 at 12:07
  • i am not sure but i use weak for all my outlets!!! – Teja Nandamuri Sep 04 '15 at 12:25
  • yes thats the point...I want the reason if I use strong what happens,,, – user5214391 Sep 04 '15 at 12:37
  • @user5214391 While the dupe says this: "subviews/controls of a view controller's main view because those views are already strongly held by the main view." a better answer is this: http://stackoverflow.com/questions/7678469/should-iboutlets-be-strong-or-weak-under-arc Generally you use weak to prevent a retain cycle. Apple used to recommend weak outlets but now they are recommending strong outlets and are updating their documentation. So use a strong outlet unless the view you are retaining retains something higher in the hierarchy than itself as that could result in a retain cycle. – Metabble Sep 04 '15 at 21:46

0 Answers0