编译警告关于缺少@required协议方法不出现 [英] Compile Warnings About Missing @required Protocol Methods NOT Appearing

查看:251
本文介绍了编译警告关于缺少@required协议方法不出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天早上在修改XCode 4.5.2,想要创建一个表格视图我自然添加了 UITableViewDataSource UITableViewDelegate 协议到我的视图控制器定义。

  #import< UIKit / UIKit.h> 

@interface MyViewController:UIViewController< UITableViewDataSource,UITableViewDelegate>

@end

#importMyViewController.h

@implementation MyViewController

@end
现在我知道在这个阶段我需要实现 @required


$ b > UITableViewDataSource 协议的方法,但出于(推定TDD)习惯我决定先执行构建,期望编译器会抛出关于未实现的@required方法的警告(指示我要实现哪些)。



但没有编译完成没有一个错误或警告从编译器,困惑和关注我略微。



所以我意识到这个问题通常是相反的方式,即为什么我得到这个警告,而不是为什么我没有得到这个警告简单的问题真的让我迷惑。显然我做错了,但我不知道什么。任何想法如何这是可能的?



FYI这是一个新的项目,没有建立/项目设置定制一个全新的干净安装XCode 4.5.2在新的Mac 。在XCode 4.5.x中有一个选项,用于设置不同的警告显示(YES / NO)。你可以检查它在构建设置编译器警告LLVM 4.1编译器。



我希望它能解决您的问题。


I was tinkering with XCode 4.5.2 this morning and wanting to make a table view I naturally added the UITableViewDataSource and UITableViewDelegate protocols to one on my view controller definitions.

#import <UIKit/UIKit.h>

@interface MyViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>

@end

#import "MyViewController.h"

@implementation MyViewController

@end

Now I know at this stage I need to implement the @required methods of the UITableViewDataSource protocol but out of (presumably TDD) habit I decided to perform a build first with the expectation that the compiler would throw up warnings about the unimplemented @required methods (indicating to me which ones to implement).

But NO the build completed without a single error or warning from the compiler which has confused and concerned me slightly.

So I realize this question is normally the other way round i.e. 'why I am getting this warning', instead of 'why am I NOT getting this warning' but this really simple issue has really baffled me. Clearly I'm doing something wrong but I've no idea what. Any ideas how this might be possible?

FYI this a new project with no build/project setting customisation on a brand new clean install of XCode 4.5.2 on a new Mac Book.

解决方案

In XCode 4.5.x there is a option for setting different warnings to display (YES/NO). You can check it under build setting Compiler Warnings for LLVM 4.1 compiler.

I hope it'll resolve your issue.

这篇关于编译警告关于缺少@required协议方法不出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆