It seems like weakAddressOf is the “proper” way to grab a delegate for use in an event-handling & processing mechanism.
The only problems are:
Without some of the discussed (in older forum posts) feature additions, are they useful at all or just a world of hurt?
Norman_P
(Norman P)
#2
you can compare them
just use =
if deletage1 = delegate2 will tell you if they reference the same method but thats about it
Well, I see in this older discussion that comparison of weakAddressOf doesn’t work as expected.
But more important to me is the problem that the class instance that supplied the delegate can disappear and we can’t test for that effectively.
This seems to render the weakAddressOf method of delegate creation rather moot. At least for my purposes…
The weakRef is great for it’s weakness capabilities, but not being able to use it for it’s weakness capabilities…
[quote=125158:@Andrew Lambert]WeakAddressOf
is useful for avoiding circular references.
[/quote]
Yeah, I get that. The problem is that I can’t check to see if the method (the class instance it belongs to) still exists before I call it.
It does not change to nil, like I think it should… I think.
Anyway, if I call it, I get a crash.