Iphone Core Data crashing on Save

前端 未结 7 735
执念已碎
执念已碎 2020-12-03 06:01

I\'m currently writing an Iphone application using Core Data and I get a EXC_BAD_ACCESS error during the [managedObjectContext save:&&error] code line.

7条回答
  •  醉酒成梦
    2020-12-03 06:22

    Solved the problem though I'm not sure I'm addressing the actual root cause. The error was eliminated when I added this line:

    [managedObjectContext setRetainsRegisteredObjects:YES];
    

    To where I create the managedObjectContext. So I guess it had to do with retain counts. I'm guessing that maybe instance variables get released partially or temporarily or something when modal views are presented? I don't know. In any case, this error was eliminated the the program works fine now.

提交回复
热议问题