iOS?????????-??????
???????????? ???????[ 2015/8/26 14:05:26 ] ??????????????? iOS ????
??????????????????????????
???????????????????????????
????????г???????????????η?????????η?????????
????????????????????????????????м????????????????????????????
// .h???
#define YHSingletonH(name) + (instancetype)shared##name;
// .m???
#define YHSingletonM(name)
/**
* ????static????????????????????????
* ???static????????粻?????_instance??????
*/
static id _instance;
/**
* ?????????????????
*/
+(instancetype)allocWithZone:(struct _NSZone *)zone
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken?? ^
{
_instance = [super allocWithZone:zone];
});
return _instance;
}
/**
* ????????????Σ????????????????????????
*/
-(instancetype)init
{
__block typeof(self) onceSelf = self;
static dispatch_once_t onceToken;
dispatch_once(&onceToken?? ^
{
onceSelf = [super init];
});
return onceSelf;
}
/**
* ???????????????????????????
*/
+(instancetype)shared##name
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken?? ^
{
_instance = [[self alloc] init];
});
return _instance;
}
/**
* ????????????????????????????????<NSCopying>Э??
*/
-(id)copyWithZone:(NSZone *)zone
{
return _instance;
}
??????????
??????.h???
#import <Foundation/Foundation.h>
// ???????????
#import "YHSingleton.h"
@interface YHXXX : NSObject
/** ???? */
@property (nonatomic?? strong) NSString *name;
/** .h????????YHSingletonH???? */
YHSingletonH(XXX)
@end
??.m???
#import "YHXXX.h"
@interface YHXXX()
@end
@implementation YHXXX
/** .m????????YHSingletonM?????????? */
YHSingletonM(XXX)
@end
?????????????ü?????????
static id _instance;???????????????????????????′?????????????£?
// ?????????????
YHSingelton
// YHPerson?????YHSingelton
YHPerson : YHSingelton
// YHCar??????YHSingelton
YHCar : YHSingelton
// ????????????YHPerson????
// ???static id _instance;?????????????????
NSLog(@"%@---%@"?? [YHPerson sharedInstance]?? [[YHCar sharedInstance]);
??????????????????????????????????б??????GCD?????????????дallocWithZone:????????????
// ?????????
+ (instancetype)allocWithZone:(struct _NSZone *)zone
{
if (_instance == nil)
{
@synchronized(self)
{
if(_instance == nil)
{
_instance = [super allocWithZone:zone];
}
}
}
return _instance;
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???д?ò??????????????????????д?淶??α??????????????????????????????????????????????????????е?Ч?????в????г??????????????????????в?????????????в????г????????????????????????????в????е???????????????????????????????????????ж??????????????????????????????ALM(??????????????)????????????????excel????????ALM(??????????????)????????????????????????????????????????????????д????????????????????????????????????????????????????????????????????????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????