NSFetchedResultsController 和 BAD_ACCESS
我有一个由 NSFetchedResultsController
提供的 UITableViewController。
一切工作正常,直到我添加
if (self.fetchedResultsController != nil)
{
return self.fetchedResultsController;
}
到我的方法的开头
-(NSFetchedResultsController *)fetchedResultsController {
。我得到的错误是:
程序收到信号:“EXC_BAD_ACCESS”。
知道为什么会这样吗?我
@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
在 .h 文件和
@synthesize fetchedResultsController
实现文件中声明。
谢谢~
I have a UITableViewController
that is fed by a NSFetchedResultsController
.
Everything worked fine, until I added
if (self.fetchedResultsController != nil)
{
return self.fetchedResultsController;
}
to the beginning of my
-(NSFetchedResultsController *)fetchedResultsController {
method. The error I get is:
Program received signal: “EXC_BAD_ACCESS”.
Any idea why this could be? I declare
@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
in the .h file and
@synthesize fetchedResultsController
in the implementation file.
Thank you~
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您正在引用一个未初始化的指针。你初始化了
fetchedResultsController
吗?在类的 init 方法中添加:这有帮助吗?
Looks like you're referencing an uninitialised pointer. Have you initialised
fetchedResultsController
? In your class's init method add:Does this help?
这是设置递归调用,使用 self.fetchedResultsController 调用 fetchedResultsController 方法吗?
Is that setting up a recursive call, with self.fetchedResultsController invoking the fetchedResultsController method?