I have a UICollectionView whose collectionView:numberOfItemsInSection: is defined as follows:
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return self.contents.count;
}
self.contents is lazily allocated as follows:
- (NSArray *)contents
{
if (!_contents) {
_contents = [[XYZSharedMemoryStore sharedStore] clContents];
}
return _contents;
}
clContents returns an NSArray, as follows:
- (NSArray *)clContents
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"cl_contents" ofType:@"plist"];
NSArray *products = [[NSArray alloc] initWithContentsOfFile:path];
return products;
}
XYZSharedMemoryStore is a singleton defined as follows:
+ (id)sharedStore
{
static XYZSharedMemoryStore *sharedStore = nil;
if (!sharedStore) {
sharedStore = [[super allocWithZone:NULL] init];
}
return sharedStore;
}
+ (id)allocWithZone:(NSZone *)zone
{
return [self sharedStore];
}
- (id)init
{
self = [super init];
if (self) {
// STUFF
}
return self;
}
Going full circle, the problem I'm having is that self.contents.count in collectionView:numberOfItemsInSection: returns 0 when I'm in a release profile and the correct number (10) in debug mode, so in the release profile, my UICollectionView doesn't display any cells. The profiles are in the default state that Xcode creates them in.
Any ideas what might be going on here?