繁体   English   中英

@在 Objective-C 中受保护

[英]@protected in Objective-C

我有一个简单的 class:

#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>

@interface MyTableViewController : UITableViewController
{
@protected
    NSFetchedResultsController *_fetchedResultsController;
}

还有一个:

#import <UIKit/UIKit.h>

@interface MyChildTableViewController : MyTableViewController
{
}

- (void)someMethod;

问题是我不能在MyChildTableViewController class 中使用_fetchedResultsController 我得到编译时错误:'_fetchedResultsController' undeclared (first use in this function)`

这里有什么问题?

ughoavgfhw在评论中发布了正确答案。 我已经要求他(也在评论中)将其重写为答案 - 所以我可以接受。 但他没有。 所以我会发布我自己的答案,只是为了关闭问题并将其从未回答中删除。

解决方案:
在项目设置中将C/C++ Compiler Version更改为LLVM compiler 2.0

我也有同样的问题,通过使用 self->,一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM