Suppress warning “Category is implementing a method which will also be implemented b
来源:互联网 发布:msi风扇控制软件 编辑:程序博客网 时间:2024/05/16 01:07
xcode升级到4.4.1
如果一个对一个类中的函数进行重载,会报错
Suppress warning “Category is implementing a method which will also be implemented by its primary class”
解决方法是在重载函数实现前后加上下面的3行即可
===========================
http://stackoverflow.com/questions/9424004/suppress-warning-category-is-implementing-a-method-which-will-also-be-implement
Although everything bneely said is correct, it doesn’t actually answer your question of how to suppress the warning.
If you have to have this code in for some reason (in my case I have HockeyKit in my project and they override a method in a UIImage category) and you need to get your project to compile, you can use#pragma
statements to block the warning like so:
#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"// do your override#pragma clang diagnostic pop
I found the information here: http://www.cocoabuilder.com/archive/xcode/313767-disable-warning-for-override-in-category.html
- #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
// do your override
#pragma clang diagnostic pop
==============================
加以上3句只是屏蔽编译器的提醒错误,并没有真正的解决.
这个提醒的问题是因为catagate没法对方法进行重载.
解决办法就是新建一个继承父类的子类,然后在子类中重载该方法即可.
- Suppress warning “Category is implementing a method which will also be implemented b
- xcode升级到4.4.1后 Suppress warning “Category is implementing a method which will also be implemented by
- 警告: Category is implementing a method which will also be implemented by its primary class
- category is implementing a method which will also be implemented bt its primary class
- iOS警告:Category is implementing a method which will also be implemented by its primary class
- Xcode警告Category is implementing a method which will also be implemented by its primary class 处理
- Xcode警告Category is implementing a method which will also be implemented by its primary class 处理
- Class JavaLaunchHelper is implemented in both. One of the two will be used. Which one is undefined
- Class PLBuildVersion is implemented in both. One of the two will be used. Which one is undefined.
- [经验]Class MediaTransCoder is implemented in both One of the two will be used. Which one is undefined
- mac idea 执行报错Class JavaLaunchHelper is implemented in both *. One of the two will be used. Which one
- iOS:Class Foo is implemented in both MyApp and OtherApp. One of the two will be used. Which one is u
- [Warning] '--default-character-set' is deprecated and will be removed in a future release
- Cannot call method in class, which is explicitly implemented from interface, through new object
- Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a
- WARNING:XXX is deprecated and will be removed...
- gcc warning:‘Test::b’will be initialized after
- objc[2213]: Class _NSZombie_BSXPCMessage is implemented in both ?? and ??. One of the two will be us
- apache2 + git + gerrit + mysql 配置、简单git操作
- 欢迎使用CSDN-markdown编辑器
- XCUIElementAttributes API
- iOS——二维码扫描
- 使用Nginx做邮件代理服务器配置
- Suppress warning “Category is implementing a method which will also be implemented b
- Invert Binary Tree
- android获得手机联系人信息代码
- 如何实现从工程师向管理者的转型
- 我的Java开发学习之旅------>Java经典排序算法之二分插入排序
- 网站整理
- MAC OX 配置JDK环境变量
- Android学习笔记04:Android 缓冲进度条或加载进度条
- 51单片机矩阵键盘扫描