开发者

CoreData EXC_BAD_ACCESS, Could not access memory KERN_PROTECTION_FAILURE at address: 0x00000000

开发者 https://www.devze.com 2022-12-15 07:14 出处:网络
I have a program using CoreData and a navigation开发者_StackOverflow中文版 controller.If I add a entity that is connected to my main entity through a relationship than back out to the table view of al

I have a program using CoreData and a navigation开发者_StackOverflow中文版 controller. If I add a entity that is connected to my main entity through a relationship than back out to the table view of all entries and the back into the same, recently edited, entry my program crashes. My code is very similar, and for the CoreData part the same, to Apples sample code iPhoneCoreDataRecipes.

The code will crash the first time I attempt to access the entity that I just changed with a "EXC_BAD_ACCESS".

If I pause the program before that occurs and try and access my CoreData object I get the following in the console.

Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0xec0470f2 0x937eeedb in objc_msgSend () The program being debugged was signaled while in a function called from GDB. GDB has restored the context to what it was before the call. To change this behavior use "set unwindonsignal off" Evaluation of the expression containing the function (_NSPrintForDebugger) will be abandoned.

 NSMutableArray *tempEventsArray = [[NSMutableArray alloc] initWithArray:[journalEntry.event allObjects]];
 self.eventsArray = tempEventsArray;
 [tempEventsArray release];

Apple's iPhoneCoreDataRecipes has the same problem so I will submit a bug report but did not know if I was missing some thing. My iPone development target 3.1 and base SDK is also 3.1.


How is eventsArray declared? From your usage, it should be a retained property. It it's only assign, then you're crashing due to over-releasing the array.

0

精彩评论

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

关注公众号