i want to store a custom object with a block in NSUserDefaults. I’ve already implement
- (void)encodeWithCoder:(NSCoder *)encoder and - (id)initWithCoder:(NSCoder *)decoder
is there a way to store myblock variable during this call ?
something like this :
- (void)encodeWithCoder:(NSCoder *)encoder
{
[encoder encodeSomething:self->_myblock forKey:@"myblock"];
}
I’ve already tried to encodeObjectf and it does not seems to work…
if someone already try this, i might appreciate your help 🙂
Elendar.
Seems that’s not possible directly. You may do this indirectly, nice solution suggested here: Is there any way to serialize / unserialize an Objective-C block?