在Objective-C中保护@protected

kpo*_*wer 5 inheritance protected objective-c ios

我有一个简单的课程:

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

@interface MyTableViewController : UITableViewController
{
@protected
    NSFetchedResultsController *_fetchedResultsController;
}
Run Code Online (Sandbox Code Playgroud)

还有一个:

#import <UIKit/UIKit.h>

@interface MyChildTableViewController : MyTableViewController
{
}

- (void)someMethod;
Run Code Online (Sandbox Code Playgroud)

问题是我不能_fetchedResultsControllerMyChildTableViewController课堂上使用.我得到编译时错误:'_fetchedResultsController'未声明(在此函数中首次使用)

这有什么不对?

kpo*_*wer 0

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

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