views:

40

answers:

1

I assign an object to an NSValue like this:

[NSValue valueWithNonretainedObject:myObject];

What happens if that object gets deallocated from memory, and then I try to pull it out from that NSValue? Would the reference be nil? How could I check if the object is still there? Or would the app just crash when something like this happens?

+2  A: 

it would most likely crash, if you try and access the value of a freed object it would probably crash i think, or return nil, why dont you give it a try? :) seems pretty simple to do

Daniel