나는 클래스 확장에 jQuery과에 속성을 추가하고 싶습니다 : 다음아이폰 OS 클래스 확장의 속성을 정의
@interface UITableViewController()
@property NSString *entityString;
@end
내가 확장을 가져온 다음 내가있는 UITableViewController의 서브 클래스에 entityString 속성을 사용
를@implementation CustomerTableViewController
- (void)viewDidLoad {
self.entityString = @"Customer";
...
[super viewDidLoad];
}
...
Apple documentation는 말한다 :
the compiler will automatically synthesize the relevant accessor methods (...) inside the primary class implementation.
을하지만 전하려고 할 때 그것을 ecute 나는이 오류가 발생 :
-[CustomerTableViewController setEntityString:]: unrecognized selector sent to instance 0x737b670
내가 뭘 잘못하고있어? 어쩌면 하위 클래스에서 속성에 액세스 할 수 없습니까?
클래스 확장에 ivars를 추가 할 수 없습니까? 아니면 사용 된 컴파일러에 따라 다릅니 까? – tiguero
클래스 확장에서 ivars 및 속성을 선언 할 수 있지만 클래스의 @implementation을 컴파일하기 전에 컴파일러에서 확장을 확인하지 않으면 해당 저장소가 만들어지지 않습니다. – bbum
명확히 해 주셔서 고마워요. - alazaro가 실제로 프레임 워크 클래스에 클래스 확장을 사용하고 있다는 것을 알지 못했습니다. – tiguero