How to avoid “incomplete implementation” warning in partial base class

后端 未结 4 695
天命终不由人
天命终不由人 2020-12-29 08:20

I have created a protocol that my classes need to implement, and then factored out some common functionality into a base class, so I did this:

@protocol MyPr         


        
4条回答
  •  我在风中等你
    2020-12-29 09:01

    In your protocol definition, you need to declare your methods under the @optional keyword.

    Your code should look like this:

    @protocol MyProtocol
    
    @optional
    - (void) foo;
    - (void) bar;
    
    @end
    

    See this question on SO.

提交回复
热议问题