• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Detecting Threading Design Errors in Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Detecting Threading Design Errors in Core Data


  • Subject: Detecting Threading Design Errors in Core Data
  • From: Jerry Krinock <email@hidden>
  • Date: Tue, 16 Jun 2009 17:58:53 -0700

The Core Data application I'm working on uses NSOperation and NSOperationQueue for managing tasks. Since I don't want multiple managed object contexts and all that entails, I handle the threading issues by wrapping methods that require Core Data database access with performSelectorOnMainThreadXXXXX.

I was getting a few nonrepeatable crashes indicating sqlite statements being received out of sequence. I found and repaired a few Core Data- base accesses that I had "missed", and now I'm not getting any more crashes.

As I understand it, something as simple as getting a managed object's attribute off the main thread can cause a crash, but not very often, so I'm worried that I haven't found all of my threading design errors yet.

Could I concoct some kind of test which would amplify these design errors? For example, let's say I could grab the internal method which Core Data uses to perform a query or something like that. I could override this method and insert an assertion that currentThread == mainThread.

Any ideas how one might concoct such a test?

Sincerely,

Jerry Krinock

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: get ref to instance from IB
  • Next by Date: Re: CoreData and ArrayControllers
  • Previous by thread: Re: get ref to instance from IB
  • Next by thread: Notification/callback of successful CGEventPost?
  • Index(es):
    • Date
    • Thread