I am not even sure if I am stating this right but I am trying to copy a user created coredata object intstance and having a pretty hard time figuring it out.
I have an object (Question) that is pulled in from the managedObjectContext
.
This is from a Quiz in my database that has many Questions.
I have my Question instance in memory named question1. I want to copy question1 to an instance called question2.
Question *question2 = question1;
Works sometimes but crashes sometimes too (I know its not the right way to do it)
I have been messing with NSCopying and -(id)copyWithZone:(NSZone *)
zone but I am just getting a blank instance back.
If anyone could help that would be great thanks!
Here is a little bit more detail.
I have question1 it is an instance of Question. for example question1.answer will return that questions answer.
I want to simply copy question1 to question2. I dont need to store question2 in the datamodel or anything I just need to use it in a loop then release.
Basically I want to do this:
Question *question2 = question1;
NSLog(@"%@", question2.answer)
The above is working sometimes but then sometimes I am getting random crashes on the nslog line.