XC Unit tests issues with Core Data
XC Unit tests issues with Core Data
- Subject: XC Unit tests issues with Core Data
- From: Rick Mann <email@hidden>
- Date: Fri, 26 Sep 2014 14:44:39 -0700
I'm trying to set up a unit test to exercise parts of my iOS app's code, which includes Core Data code. The test case does not run with the app as Test Host. My test case copies the test data to a temporary directory, loads the Core Data stack using the test cases' class bundle and pointing to the sqlite file in the temporary test data directory, and begins work. The work is asynchronous, so the test case sets up an expectation and waits.
The code then does a fetch request to get a few "Job" entities, loops over them and processes each in turn. The problems is, sometimes, the reference to the Job is nil when it's finally worked on. It seems that the Jobs are being deallocated, despite being held. Here's the code:
https://pastee.org/5j7hx
What bothers me is that the deletionQueue block has a reference to all the jobs in its local NSArray. But those job objects are being deallocated before it finishes. Any ideas? Thanks!
--
Rick Mann
email@hidden
_______________________________________________
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