我有一个看起来像这样的实例变量:
@property (strong, nonatomic) Post *post;
我将它设置在这样的自定义初始化方法中:
- (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...
[...]
有人知道为什么会这样吗?