Reputation: 21005
I noticed than in OSX, the NSTextView
cannot for a weak refference (if you try to link it weak, you will get)
Cannot form weak reference to instance (0x600000122da0) of class NSTextView. It is possible that this object was over-released, or is in the process of deallocation.
also the outlet from XCode is created as assign by default
Why there cannot be a weak reference? What can be the reason?
Upvotes: 6
Views: 1010
Reputation: 41
Check FAQ here Transitioning to ARC Release Notes:
Q:Which classes don’t support weak references?
A:You cannot currently create weak references to instances of the following classes: NSATSTypesetter, NSColorSpace, NSFont, NSMenuView, NSParagraphStyle, NSSimpleHorizontalTypesetter, and NSTextView.
etc.
Upvotes: 4
Reputation: 52632
Read the message carefully. Read past the word NSTextView. It tells you exactly why at this moment you cannot create a weak reference to the NSTextView. You just have to read it.
For example, while dealloc is running, you cannot create new weak references anymore because the object will be going away and all weak references will be set to nil. Trying to assign the object to a weak variable will keep that variable nil, even though the object is not nil (yet).
And this has nothing to do with NSTextView.
Upvotes: -2