【发布时间】:2013-04-30 09:16:41
【问题描述】:
我有一个看起来像这样的实例变量:
@property (strong, nonatomic) Post *post;
我在一个自定义的 init 方法中设置它,如下所示:
- (id)initWithPageType:(int)pageType andPost:(Post *)post
{
self = [super initWithNibName:@"StreamViewController" bundle:nil];
if (self) {
// Custom initialization
self.post = post;
self.pageType = pageType;
}
return self;
}
在这种情况下它永远不会是 NULL。我也有一个 NSFetchedResultsController 使用以下委托方法:
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath
{
[...]
// Here self.post == nil for some reason...
[...]
有人知道为什么会这样吗?
【问题讨论】:
-
我认为 post 对象的所有权不知何故过期了,这使它为零。
标签: ios xcode cocoa-touch nsfetchedresultscontroller