objective-c - identifierForVendor 和 iOS6

标签 objective-c ios xcode itunes

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/

相关文章:

ios - 断点条件错误

iPhone在线登录系统

iphone - Reg : modifying layer that is being finalized. ...... [CALayer frame]: 发送到释放实例 0xe43c520 的消息

ios - 使用 CocoaPods 停止使用 ionic Project 的 iOS 构建

iOS 13.0 UIMenu 和 UIContextMenuConfiguration 的 UIAction

ios - 从 nsstring 发送 Post http 请求

objective-c - Mac OS X 的 Cocoa 编程(第 3 版)已经过时了吗?

objective-c - XCode - 将测试与源链接,而不将所有源文件添加到测试任务

ios - 如何同时使用水平和垂直 ScrollView (快速)

iOS Xcode Swift 将输入名字和姓氏组合成全名问题