Using #pragma to suppress “Instance method not found” warnings in Xcode

前端 未结 5 828
野性不改
野性不改 2020-12-15 13:23

I want to use #pragma (in Xcode) to suppress the warning:

warning: instance method \'-someMethod\' not found (return type defaults to \'id\'

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 13:37

    This is how you can suppress the warnings. This is especially useful in test (fake) classes where you want to implement only a few methods of a class and don't need the rest.

    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wincomplete-implementation"
    
    @implementation MyClass
    
    
    @end
    
    #pragma clang diagnostic pop
    

提交回复
热议问题