How do I take a NSObject that I have set all the attributes of and then copy that into another block of memory that an array can use so I can re use the original one?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In short, you don’t.
If you want to put the object in an array and then create a new object, do exactly that;
addObject:to the array andalloc/inita new one.If you are asking how you copy an object into, say, a random
malloc()block somewhere — say, in the middle of an array — then that is a very different issue. It can technically be done, but basically no one does so as the frameworks and runtime aren’t designed for that.Without knowing more about your specific needs, it is impossible to go into more detail.