Why can't NSTextView find a weak link?

I noticed that in OSX NSTextView cannot for weak repetition (if you try to link it to 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 exit from Xcode is created as the default

Why can't there be a weak link? What could be the reason?

+5
source share
2 answers

Check out the FAQ here. Go to ARC Release Notes :

Q: What classes do not support weak references?

A: you cannot create weak references to instances of the following classes: NSATSTypesetter, NSColorSpace, NSFont, NSMenuView, NSParagraphStyle, NSSimpleHorizontalTypesetter and NSTextView.

and etc.

+3
source

Read the message carefully. Read the text of NSTextView. This definitely indicates why at the moment you cannot create a weak link to NSTextView. You just need to read it.

For example, while dealloc is running, you can no longer create new weak links because the object will go away and all weak links will be set to nil. Attempting to assign an object to a weak variable will keep this variable nil, even if the object is not zero (for now).

And this has nothing to do with NSTextView.

-3
source

Source: https://habr.com/ru/post/1242858/


All Articles