I am trying to optimise my app to the as best as it can get, can you please suggest which method is best, and recommended.
@implementation Methode1
+(BOOL)Isdone{
BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:@"DEVICE_TYPE"];
if(!result){
[[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"DEVICE_TYPE"];
}
return result;
}
@end
@implementation Methode2
NSString * const deviceTypeKey @"DEVICE_TYPE";
+(BOOL)Isdone{
BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:deviceTypeKey];
if(!result){
[[NSUserDefaults standardUserDefaults]setBool:YES forKey:deviceTypeKey];
}
return result;
}
@end
@implementation Methode3
#define deviceTypeKey @"DEVICE_TYPE"
+(BOOL)Isdone{
BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:deviceTypeKey];
if(!result){
[[NSUserDefaults standardUserDefaults]setBool:YES forKey:deviceTypeKey];
}
return result;
}
@end
in the three above mentioned method which one is most memory efficient and why?