objective-c - FetchResult Controller 委托(delegate) - 不兼容类型警告

标签 objective-c cocoa-touch delegates nsfetchedresultscontroller

我正在尝试使用基于 iCloud example 的 NSFetchedResultController 将我的 CoreData 连接到 iCloud .

NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:@"date" cacheName:@"Root1"];
aFetchedResultsController.delegate = self;

但是我在第二行收到这样的警告: 警告:语义问题:将“RootViewController *const __strong”传递给不兼容类型“id”的参数。我认为将 delegate 设置为 self 应该没问题,但事实并非如此。有人可以帮忙吗?

最佳答案

使 RootViewController 符合 NSFetchedResultsControllerDelegate协议(protocol)。

@interface RootViewController : UIViewController <NSFetchedResultsControllerDelegate>

关于objective-c - FetchResult Controller 委托(delegate) - 不兼容类型警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8712035/

相关文章:

iphone - UITableView 帧变化动画问题

ios - UISplitView,设置委托(delegate)时接收语义问题

ios - Swift 3 委托(delegate),协议(protocol)——TapGesture 不工作

javascript - C# 中的作用域、变量访问

ios - 以前的 UIViewController 在 iOS7 上以模态方式呈现时会渗漏

ios - 如何在 nextViewController 字符串中存储 textField 值

objective-c - 在项目中引入 Swift 后无法为 Objective-C 生成 NSManageObject

objective-c - 如何将字符串转换为 float ?

cocoa-touch - 新的 PayPal iOS SDK(测试版)- 无法连接到沙箱

ios - 如何使用 Parse Framework 和自定义登录?