0
我有一個實例變量,看起來像這樣:iOS的實例變量被「清零」由於未知原因,
@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...
[...]
任何人有任何想法,爲什麼發生這種情況?
這一個在ios6? – Balu 2013-04-30 09:27:24
是的,它是iOS6。 – Anders 2013-04-30 09:29:10
我認爲,發佈對象的所有權以某種方式過期,即使其爲零。 – 2013-04-30 12:06:10