identifierForVendor
需要 iOS6,因此如果我的应用目前支持 iOS4,因此我无法使用它,因为我的更新应该始终满足我的应用的前一分钟。要求?
最佳答案
你可以使用这个:
NSString *udid;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0"))
udid = [UIDevice currentDevice].identifierForVendor.UUIDString;
else
udid = [UIDevice currentDevice].uniqueIdentifier;
带有预处理器代码:
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
关于objective-c - identifierForVendor 和 iOS6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12506893/