开发者

@protected in Objective-C

开发者 https://www.devze.com 2023-03-19 08:00 出处:网络
I have a simple class: #import <UIKit/UIKit.h> #import <CoreData/CoreData.h> @interface MyTableViewController : UITableViewController

I have a simple class:

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

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

And one more:

#import <UIKit/UIKit.h>

@interface MyChildTableViewController : MyTableViewController
{
}开发者_运维问答

- (void)someMethod;

The problem is that I can't use _fetchedResultsController in MyChildTableViewController class. I get compile-time error: '_fetchedResultsController' undeclared (first use in this function)`

What's wrong here?


ughoavgfhw posted right answer in comments. I've asked him (in comments, also) to rewrite it as an answer - so I can accept it. But he didn't. So I will post my own answer, simply to close the question and remove it from unanswered.

The solution:
Change C/C++ Compiler Version to LLVM compiler 2.0 in your project's settings.


I also had the same problem, by using self->, everything worked fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消