You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
before that return statement, that obj is set to an instance of the class it is called upon with all properties of the class as nil which of course means that that evaluation at the end yields true. is this by design? my expectation was that it would return false.
The text was updated successfully, but these errors were encountered:
I don't really understand what you mean by this. objc_getAssociatedObject(self, BMSharedInstanceKey) will return nil if the value associated to the BMSharedInstanceKey is nil, which it should be if you setSharedInstance:nil.
i think this might be a clearer way to explain, here is the flow of the issue:
[MyClass setSharedInstance:nil];
[MyClass hasSharedInstance]; //evaluates to true
when debugging the above example, i expanded your method as mentioned in the original post and observed id to not actually be nil, but as being an instantiated instance of the object with all properties set to nil.
so perhaps i'm not properly nullifying my shared instances... i'm doing so by calling
setSharedInstance:nil
on a class. is this correct?my issue here is after doing the above,
hasSharedInstance
returns true.I drilled down in to the code and after expanding
to
before that
return
statement, thatobj
is set to an instance of the class it is called upon with all properties of the class asnil
which of course means that that evaluation at the end yields true. is this by design? my expectation was that it would return false.The text was updated successfully, but these errors were encountered: