开发者

Why I need to retain the managed object in order to process?

H开发者_JAVA技巧ere 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜