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 Round #276 (Div. 1) D. Kindergarten dp
D. Kindergarten Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/proble ...
- 深入理解JavaScript 模块模式
http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html 模块模式是JavaScript一种常用的编码模式.这是一般的 ...
- Html Agility Pack基础类介绍及运用
第一篇只对Html Agility Pack做了一个大概的介绍,在接下来的章节会比较深入的介绍Html Agility Pack. Html Agility Pack 源码中的类大概有28个左右,其实 ...
- android ListView 中getview学习总结
最近在做android相关的开发,ListView中有一个图片错位的问题,今天查了很多人写的一些东西,所以记录下来,算是一种加深理解吧. ListView是一个非常常用的控件,功能可以扩展的很丰富,而 ...
- IPC——消息队列
Linux进程间通信——使用消息队列 下面来说说如何用不用消息队列来进行进程间的通信,消息队列与命名管道有很多相似之处.有关命名管道的更多内容可以参阅我的另一篇文章:Linux进程间通信——使用命名管 ...
- CentOS 7 ibus 导入第三方词库
CentOS 7 自带的输入法是ibus默认有带拼音输入法“Intelligent Pinyin 1.6.91“,但是在使用过程中发现很多词汇没有.所以就想捣鼓一下,怎么把像搜狗或者其他输入法的数据库 ...
- MySQL无视密码进入Server
在[mysqld]的段中加上一句:skip-grant-tables 如下 [mysqld] skip-grant-tables 即可不输入密码就可以进入mysql server,然后就可以随便修改数 ...
- iOS-自定义导航栏后侧滑返回功能失效
iPhone有一个回退按钮在所有的导航条上.这是一个简单的没有文字箭头. 在一开始写项目的时候,就要做好一个准备,导航栏是自定义还是使用系统的,后期有什么改动,有什么比较特殊的需求.当然这些在更改需求 ...
- web开发下的各种下载方法
利用TransmitFile方法,解决Response.BinaryWrite下载超过400mb的文件时导致Aspnet_wp.exe进程回收而无法成功下载的问题. 代码如下: Response.Co ...
- JSON特殊字符处理
JSON 是适用于 Ajax 应用程序的一种有效格式,原因是它使 JavaScript 对象和字符串值之间得以快速转换.由于 Ajax 应用程序非常适合将纯文本发送给服务器端程序并对应地接收纯文本,相 ...