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 #181 (Div. 2) B. Coach 带权并查集
B. Coach 题目连接: http://www.codeforces.com/contest/300/problem/A Description A programming coach has n ...
- Qt学习之自定义窗口部件
自定义Qt窗口部件 实现一个十六进制的SpinBox,一般SpinBox只支持十进制整数,但是可以子类化方法实现该功能 需重新实现以下虚函数 virtual QString textFromValue ...
- Ubuntu 14.04 Android 使用Maven二 创建自己的Mavenproject
依据https://code.google.com/p/maven-android-plugin/wiki/GettingStarted 介绍,有两种方法能够创建Mavenproject. 第一种方法 ...
- IOS试题收集1
IOS试题收集1 1.Objective C中有多继承吗?没有的话用什么代替? Protocol 2.Objective C中有私有方法吗?私有变量呢? OC类里面只有静态方法和实例方法这两种,@pr ...
- ios上比较好用的Cydia插件
1.iFile查看系统文件 2.KuaiDial归属地数据库 3.KuaiDial电话拨号助手 4.搜狗输入法 Photo Editor 房贷计算器
- SMO优化算法(Sequential minimal optimization)
原文:http://www.cnblogs.com/jerrylead/archive/2011/03/18/1988419.html SMO算法由Microsoft Research的John C. ...
- History(历史)命令用法15例
导读 如果你经常使用 Linux 命令行,那么使用 history(历史)命令可以有效地提升你的效率,本文将通过实例的方式向你介绍 history 命令的 15 个用法. 使用 HISTTIMEFOR ...
- Linux 测试网速
Linux 测试网速 1.直接wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip 一个10M的文件, ...
- 第一个c++程序 helloworld
// helloworld.cpp : 定义控制台应用程序的入口点.// #include "stdafx.h"#include "iostream" int ...
- MySql 5.7安装配置
最新的MySql免安装版配置: 1,解压缩: 2,添加系统环境变量,PATH=.......;C:\Program Files\MySQL\MySQL Server 5.7\bin 3,修改MySql ...