3

iOS 10 でデバイスを一意に識別する新しい方法を見つけた人はいますか? その領域の変更について言及している文書を見たことがないので、ベンダーの識別子に降伏する前に質問したいと思いました.

4

1 に答える 1

1

ストアに送信する場合、残っている唯一の実際の識別子は、AdSupport フレームワークの広告識別子です。

うさぎの穴をもう少し掘り下げて、安全でない API 領域に入る可能性がある場合は、IOKit にフックして、デバイスのバッテリー識別子を取得しようとすることができます。これは、拡張機能のAnthony 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 で動作します。

于 2016-06-29T14:07:36.350 に答える