I must use a union containing a class pointer, but with ARC on, and as very well explained here: __unsafe_unretained NSString struct var you have to set the field __unsafe_unretained
.
That means, if I understand it well, you must manage yourself its lifecycle.
For example:
typedef union FOO {
char __char;
__unsafe_unretained NSMutableArray * __array;
__unsafe_unretained BarClass * __bar;
}
If I do something like:
FOO * foo = malloc(sizeof(FOO));
foo.__bar = [[BarClass alloc] init];
... // I have fun with foo.__bar
[foo.__bar release] // this was before ARC and does not work anymore
free(foo);
How do I release foo.__bar
? Because with ARC I cannot call release
or autorelease
anymore?