ios警告:Category is implementing a method which will also be implemented by its primary class 引发的相关处理
今天在处理项目中相关警告的时候发现了很多问题,包括各种第三方库中的警告,以及各种乱七八糟的问题 先说说标题中的问题 Category is implementing a method which will also be implemented by its primary class 这个警告的意思是 我在category中重写了原类的方法 而苹果的官方文档中明确表示 我们不应该在category中复写原类的方法,如果要重写 请使用继承 原文是这样的:A category allows you to add new methods to an existing class. If you want to reimplement a method that already exists in the class, you typically create a subclass instead of a category. 所以这里就出现了警告,警告而已,毕竟不是错误,所以也不会影响我们的使用,但是会让人看着很不爽,所以查了一下不显示这个警告的方法
1.在相关位置插入下面这段代码
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation" // your override #pragma clang diagnostic pop
2.在target的 build settings下 搜索other warning flags 然后给其添加 -Wno-objc-protocol-method-implementation
好了 警告没有了
这里顺便说一下 2中的方法 对很多批量的警告很有用 而后面相关字段 -Wno-objc-protocol-method-implementation 其实是可以查得到的 方法是在xcode中选择你想屏蔽的警告,右键选择 reveal in log 就可以在警告详情中发现 -Wobjc-protocol-method-implementation 这么一个格式的字段 在-W后添加一个no- 然后在用2中的方法添加到 other warning flags 中 就可以处理大部分的警告了
ios警告:Category is implementing a method which will also be implemented by its primary class 引发的相关处理的更多相关文章
- IOS 警告 收集
Semantic Warnings Warning Message -WCFString-literal input conversion stopped due to an input byte t ...
- iOS警告收录及科学快速的消除方法
来自: http://www.cnblogs.com/dsxniubility/p/4757760.html iOS警告收录及科学快速的消除方法 前言:现在你维护的项目有多少警告?看着几百条警 ...
- iOS类别(Category)
iOS类别(Category)与扩展(Extension) 苹果的官方文档 Category在iOS开发中使用非常频繁.尤其是在为系统类进行拓展的时候,我们可以不用继承系统类,直接给系统类添加方法,最 ...
- idea @Override is not allowed when implementing interface method
转自:http://blog.csdn.net/shenya2/article/details/50460447 在编码过程发现报错:@Override is not allowed when imp ...
- Override is not allowed when implementing interface method Bytecode Version Overriding and Hiding Methods
java - @Override is not allowed when implementing interface method - Stack Overflow https://stackove ...
- IDEA @Override is not allowed when implementing interface method(转载)
近期研究idea,在编码过程发现报错:@Override is not allowed when implementing interface method .找到一个老外的回答,感觉挺有用的,记录下 ...
- iOS 警告收集快速消除
1.ld: warning: directory not found for option 去掉警告的方法 工程老是提示ld: warning: directory not found for opt ...
- iOS分类(category),类扩展(extension)—史上最全攻略
背景: 在大型项目,企业级开发中多人同时维护同一个类,此时程序员A因为某项需求只想给当前类currentClass添加一个方法newMethod,那该怎么办呢? 最简单粗暴的方式是把newMethod ...
- iOS 警告收录及科学快速的消除方法
http://www.cocoachina.com/ios/20150914/13287.html 作者:董铂然 授权本站转载. 前言:现在你维护的项目有多少警告?看着几百条警告觉得心里烦么?你真的觉 ...
随机推荐
- Codeforces Gym 100463B Music Mess Hash 逻辑题
Music Mess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463/attachments ...
- js 获取cookie
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head ...
- [ES6] 12. Shorthand Properties in ES6
Where destructuring in ES6 allows you to easily get properties out of an object, this shorthand prop ...
- qt的安装和debug
qt-opensource-windows-x86-msvc2013_64_opengl-5.3.0 这个已经包含了qt-creator-opensource-windows-x ...
- mysql describe
describe命令一.describe命令用于查看特定表的详细设计信息,例如为了查看guestbook表的设计信息,可用:describe guestbook describe ol_user us ...
- Spring MVC 中 HandlerInterceptorAdapter的使用--转载
原文地址:http://blog.csdn.net/liuwenbo0920/article/details/7283757 一般情况下,对来自浏览器的请求的拦截,是利用Filter实现的,这种方式可 ...
- UIView 的transitionFromView方法实现视图切换
#import "ViewController.h" @interface ViewController () @property (strong, nonatomic) IBOu ...
- Socket 使用笔记与注意事项(一)
SocketAsyncEventArgs 1.该参数可以重复使用. 2.SocketAsyncEventArgs 的事件执行触发之后可以使用. 3.SocketAsyncEventArgs 的事件还在 ...
- Java基础知识强化之IO流笔记81:NIO之 DatagramChannel
1. Java NIO中的DatagramChannel是一个能收发UDP包的通道.因为UDP是无连接的网络协议,所以不能像其它通道那样读取和写入.它发送和接收的是数据包. 2. DatagramCh ...
- 【Android 界面效果19】Android中shape的使用
Android中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shape有了大体的了解,稍作总结: 先看下面的代码: <shape> ...