【发布时间】:2014-02-15 03:14:36
【问题描述】:
假设我有一个像这样初始化的sharedInstance
+ (MySingleton *)sharedInstance
{
static TheConstantsPlaceholder *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[TheConstantsPlaceholder alloc] init];
// Do any other initialisation stuff here
});
return sharedInstance;
}
那么,在引用该对象的类中我应该做什么(以及为什么要这样做):
@property (strong, readwrite) MySingleton * mySingleton?或者:
@property (weak, readwrite) MySingleton * mySingleton?
【问题讨论】:
标签: cocoa-touch cocoa memory-management properties singleton