ngIdentifier和identifierForVendor

ngIdentifier和identifierForVendor

本文介绍了advertisingIdentifier和identifierForVendor返回“00000000-0000-0000-0000-000000000000”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了这种方法来获取 advertisingIdentifier identifierForVendor

I've implemented this methods to get advertisingIdentifier and identifierForVendor:

- (NSString *) advertisingIdentifier
{
    if (!NSClassFromString(@"ASIdentifierManager")) {
        return [OpenUDID value];
    }
    return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
}

- (NSString *) identifierForVendor
{
    if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
        return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
    }
    return @"";
}

- (BOOL)isAdvertisingTrackingEnabled
{
    if (NSClassFromString(@"ASIdentifierManager") && ![[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
        return NO;
    }
    return YES;
}

在模拟器上一切正常,我可以获得2个字符串ID代表。

On simulator everything is working as should be and I can get the 2 strings IDs representation.

但是当我从带有iOS 6.0的iPhone 3GS(10A403)运行时,这两种方法返回00000000-0000-0000-0000 -000000000000作为标识符。
已完成:

But when I run from iPhone 3GS with iOS 6.0 (10A403), these 2 methods return "00000000-0000-0000-0000-000000000000" as identifier.Already done:


  • 重新启动设备

  • 删除应用并重新安装

  • 创建,安装,删除并再次安装Ad-Hoc

  • 从其他应用运行此代码

  • 使用iOS 6.0(10A403)在iPad 2上测试,一切都确定(我有正确的标识符)

  • Restarted the device
  • Removed the app and reinstalled
  • Created and Ad-Hoc build, installed, removed and installed again
  • Run this code from another app
  • Tested on iPad 2 with iOS 6.0 (10A403) and everything went ok (I've got the correct identifiers)

推荐答案

这似乎是iOS中的一个错误。在已通过无线升级的设备上看到相同的问题,但使用Xcode或iTunes升级的设备按预期工作,没有零。

It appears to be a bug in iOS. Seeing the same issue on devices that have been upgraded over-the-air, but devices upgraded with Xcode or iTunes work as expected without zeros.

尝试过类似的步骤,并且唯一的共同主题是无线(坏)与系留升级(好)。

Tried similar steps as you, and the only common theme was over-the-air (bad) versus tethered upgrade (good).

更新:直接从iOS 5.1到6.1空中体验不同的行为。每次完全关闭并重新启动应用程序时, identifierForVendor 都会返回一个新值。如果应用程序正在卸载并重新安装,则会出现这种情况,但事实并非如此。

Update: Users that move directly from iOS 5.1 to 6.1 over-the-air experience a different behavior. Every time the app is closed completely and restarted, a new value is being returned by identifierForVendor. This would be expected if the app was being uninstalled and reinstalled, but that's not the case.

这篇关于advertisingIdentifier和identifierForVendor返回“00000000-0000-0000-0000-000000000000”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 18:19