Tôi có một lớp đơn giản:@protected trong Objective-C
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
@interface MyTableViewController : UITableViewController
{
@protected
NSFetchedResultsController *_fetchedResultsController;
}
Và thêm một:
#import <UIKit/UIKit.h>
@interface MyChildTableViewController : MyTableViewController
{
}
- (void)someMethod;
Vấn đề là tôi không thể sử dụng _fetchedResultsController
trong MyChildTableViewController
lớp. Tôi nhận được lỗi biên dịch thời gian: '_fetchedResultsController' chưa khai báo (sử dụng lần đầu tiên trong chức năng này) `
Có gì sai ở đây?
P.S .: 'self -> _ fetchedResultsController' hoạt động ... – kpower
Khi bạn đã tìm ra, thêm' self-> 'đã hoạt động. Tôi cũng nghe nói rằng việc chuyển sang LLVM sẽ làm cho nó hoạt động mà không có điều đó, và [tài liệu] (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocDefiningClasses.html % 23 // apple_ref/doc/uid/TP30001163-CH12-87895) dường như chỉ ra điều đó. – ughoavgfhw
ughoavgfhw, xin vui lòng, viết bình luận của bạn như là câu trả lời - lời khuyên của bạn đã giúp tôi (tôi đã thay đổi 'C/C++ Compiler Version' thành' LLVM compiler 2.0') và tôi muốn đánh dấu nó là câu hỏi đúng và gần. – kpower