+ (JYueMyTaskManagerService*)sharedMyTaskService {
staticdispatch_once_tonceToken;
dispatch_once(&onceToken, ^{
_myTaskService= [[JYueMyTaskManagerServicealloc]init];
});
return_myTaskService;
}
单例模式创建的对象不能主动销毁
+ (JYueMyTaskManagerService*)sharedMyTaskService {
staticdispatch_once_tonceToken;
dispatch_once(&onceToken, ^{
_myTaskService= [[JYueMyTaskManagerServicealloc]init];
});
return_myTaskService;
}
单例模式创建的对象不能主动销毁
本文标题:ios -- 创建单例
本文链接:https://www.haomeiwen.com/subject/fpvruttx.html
网友评论