2011-08-13 4 views

답변

4

NSKeyValueObservinginformal protocol입니다 :

An informal protocol is a category on NSObject, which implicitly makes almost all objects adopters of the protocol. (...) Implementation of the methods in an informal protocol is optional. Before invoking a method, the calling object checks to see whether the target object implements it.

당신은 꺾쇠 괄호 구문을 사용하여 비공식 프로토콜을 채택 할 수없는, 그 공식 프로토콜입니다. 비공식 프로토콜을 사용하면 간단하게 프로토콜 메소드를 구현할 수 있습니다. 귀하의 시도는 @interface 블록 프로토콜 NSKeyValueObserving을 준수합니다 :

@interface ThreadsViewController : UIViewController <NSKeyValueObserving> 

컴파일러가 불평하는 이유입니다. Protocols에서

:

Being informal, protocols declared in categories don’t receive much language support. There’s no type checking at compile time nor a check at runtime to see whether an object conforms to the protocol.

0

NSKeyValueObserving에 대한 설명서를 확인해야합니다. 프레임 워크가 상주하는 것을 맨 위에서 찾을 수 있습니다. 프로젝트에 해당 프레임 워크를 포함시키고 있는지 확인하십시오.

0

FoundationFramework가 프로젝트에 추가 되었습니까? 그렇지 않은 경우 추가하십시오.

관련 문제