IBOutlet for NSTextView in a ARC project

前端 未结 1 511
别跟我提以往
别跟我提以往 2021-02-07 02:48

As you read here in most cases a IBOutlet should be weak.

Now as you can read in the development library not all classes support weak references. (e.g. NST

1条回答
  •  生来不讨喜
    2021-02-07 02:55

    I think I found the reason why some classes don't support a weak reference:

    As you can read here:

    Rationale: historically, it has been possible for a class to provide its own reference-count implementation by overriding retain, release, etc. However, weak references to an object require coordination with its class's reference-count implementation because, among other things, weak loads and stores must be atomic with respect to the final release. Therefore, existing custom reference-count implementations will generally not support weak references without additional effort. This is unavoidable without breaking binary compatibility.

    0 讨论(0)
提交回复
热议问题