2012-02-08 5 views
18

I는 다음과 같습니다 속성이 있습니다약한 특성이 형성 될 수

@property (weak, nonatomic) id<NavigationControllerDelegate> delegate; 

를하지만 내 응용 프로그램을 실행할 때 다음과 같은 오류 얻을 :

objc[4251]: cannot form weak reference to instance (0x101e0d4b0) of class TabBarController 

유일한 이유는 내가 할 수있는을 이 오류에 대한 구글에서 얻을 당신이 그것을 유지/release/dealloc, 내가 아니에요 무시하는 개체 약한 참조를 형성하려고 할 때 얻을 수 있습니다. 내 TabBarController는 NSViewController에서 상속됩니다.

누구든지이 문제의 원인을 알고 있습니까? 그것은 "할당"을 사용하면 작동하지만 분명히 "약한"것을 선호합니다. 에 따르면

+0

CocoaFu, "인스턴스에 약한 참조를 형성 할 수 없습니다 ..."입니다 항상 런타임 오류. –

답변

36

애플의 Transitioning to ARC Release Notes,

이 가 가

You cannot currently create weak references to instances of the following classes:

NSATSTypesetter , NSColorSpace , NSFont , NSMenuView , NSParagraphStyle , NSSimpleHorizontalTypesetter , and NSTextView .

Note: In addition, in OS X v10.7, you cannot create weak references to instances of NSFontManager , NSFontPanel , NSImage , NSTableCellView , NSViewController, NSWindow , and NSWindowController . In addition, in OS X v10.7 no classes in the AV Foundation framework support weak references.

(참고 : 하나의 약한 참조를 nonzeroing 매우 조심해야합니다 ...)

+0

좋은 물건! 이전에 발견 한 내용을 기반으로 NSViewController와 다른 점이 있다고 생각합니다. 나는 당신이 붙인 것을 보지 못했습니다. 고마워, 그 모든 일이 분명히 밝혀졌습니다! –