iOS 10中是否有新的设备标识符?
有没有人find一种新的方式来唯一标识iOS 10中的设备? 我还没有看到任何文件提到在这方面的变化,我想问之前,我投降了供应商的标识。
如果您正在向商店提交商品,则您唯一留下的真实标识是AdSupport框架的广告标识符。
如果你想进一步深入兔子洞并潜在的进入一些不安全的API领域,你可以挂钩到IOKit并尝试获取设备上的电池标识符。 这是从安东尼Agatiello UIDevice
扩展的要点 :
- (NSString *)batteryID { void *IOKit = dlopen("/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit", RTLD_LAZY); NSParameterAssert(IOKit); mach_port_t *kIOMasterPortDefault = dlsym(IOKit, "kIOMasterPortDefault"); NSParameterAssert(kIOMasterPortDefault); CFMutableDictionaryRef (*IOServiceNameMatching)(const char *name) = dlsym(IOKit, "IOServiceNameMatching"); NSParameterAssert(IOServiceNameMatching); mach_port_t (*IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching) = dlsym(IOKit, "IOServiceGetMatchingService"); NSParameterAssert(IOServiceGetMatchingService); kern_return_t (*IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options) = dlsym(IOKit, "IORegistryEntryCreateCFProperties"); NSParameterAssert(IORegistryEntryCreateCFProperties); kern_return_t (*IOObjectRelease)(mach_port_t object) = dlsym(IOKit, "IOObjectRelease"); NSParameterAssert(IOObjectRelease); CFMutableDictionaryRef properties = NULL; mach_port_t service = IOServiceGetMatchingService(*kIOMasterPortDefault, IOServiceNameMatching("charger")); IORegistryEntryCreateCFProperties(service, &properties, kCFAllocatorDefault, 0); IOObjectRelease(service); service = 0; NSDictionary *dictionary = (__bridge NSDictionary *)properties; NSData *batteryIDData = [dictionary objectForKey:@"battery-id"]; CFRelease(properties); properties = NULL; dlclose(IOKit); return [NSString stringWithUTF8String:[batteryIDData bytes]]; }
这仍然适用于iOS 10。