讓我們假設我有一個類ClassA的錯誤的委託聲明
頭:
@interface ClassA : NSObject
- (id)initWithDelegate:(id)delegate;
@end
實現:
@interface ClassA()
{
NSObject *_delegate;
}
@end
@implementation
- (id)initWithDelegate:(id)delegate
{
self = [super init];
if(self)
{
_delegate = delegate;
}
return self;
}
@end
因爲我跳過了@property定義我的委託聲明默認爲強?所以這段代碼是錯誤的,因爲它會導致泄漏,或者我的delagate聲明默認爲弱?
感謝您的回答 – cuda