BNRItemStore
はシングルトンであり、なぜsuper allocWithZone:
プレーンオールドの代わりに呼び出されなければならないのか混乱しましたsuper alloc
。そして、alloc
の代わりにオーバーライドしますallocWithZone
。
#import "BNRItemStore.h"
@implementation BNRItemStore
+(BNRItemStore *)sharedStore {
static BNRItemStore *sharedStore = nil;
if (!sharedStore)
sharedStore = [[super allocWithZone: nil] init];
return sharedStore;
}
+(id)allocWithZone:(NSZone *)zone {
return [self sharedStore];
}
@end