且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何以编程方式从ios7设备获取未更改的设备ID

更新时间:2023-08-30 16:27:28

我已经通过 advertisingIdentifier

正如我在那里看到的那样,advertisingIdentifier是

As I have seen there that advertisingIdentifier is


一个字母数字字符串唯一对于每个设备,......

"An alphanumeric string unique to each device, ..."

为此,我将它用作唯一标识符(尽管它用于$ b) $ b提供广告)。

For that I have used it as the unique identifier (though it is used for the serving advertisements).

我的代码是:

-(NSString*)UniqueAppId
{
    NSString *Appname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
    NSString *strApplicationUUID = [SSKeychain passwordForService:Appname account:@"manab"];
    if (strApplicationUUID == nil)
    {
        strApplicationUUID  = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
        [SSKeychain setPassword:strApplicationUUID forService:Appname account:@"manab"];
    }
    return strApplicationUUID;
}

只需在需要时调用它

[self UniqueAppId];