Pet*_*isu 6 macos cocoa objective-c nstextview
我注意到比在OSX中,NSTextView不能用于弱反射(如果你尝试将它连接起来很弱,你会得到)
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.
Run Code Online (Sandbox Code Playgroud)
默认情况下,XCode的出口也会创建为assign
为什么不能有弱参考?可能是什么原因?
gna*_*729 -2
仔细阅读该消息。读过去 NSTextView 这个词。它确切地告诉你为什么此时不能创建对 NSTextView 的弱引用。你只需要阅读它。
例如,当 dealloc 运行时,您不能再创建新的弱引用,因为该对象将消失并且所有弱引用将被设置为 nil。尝试将对象分配给弱变量将使该变量保持为零,即使该对象尚未为零。
而这与 NSTextView 无关。