views:

16

answers:

1

Here is what was going on in my code. I have a class B which contains a method retuning the fetched result R whose type is NSManagedObject to my current class A. And I assign the R to the the property pR in A. After a while another method in A tried to update the object MO and persistent it in database. However pA became nil at that time. I needed to retain the R when it was assigned to pR. I declared pR to be (nonatomic, retain) and synthesized it. Does the fetched result returned from B will be released automatically?

+1  A: 

Are you using the format:

self.pR = R;

if you only say pR = R;, R will not be retained as you are not accessing the synthesized method.

Run Loop
Yes!!!!!!!!!!!!
sza