菜鸟教程小白 发表于 2022-12-11 18:45:58

ios - 使用 iOS 10.2 在同一设备上获取不同的 UUID


                                            <p><p>我正在使用下面的代码来获取 UUID。</p>

<pre><code> -(NSString *)updateUserPhoneDetails{

    NSString *retrieveuuid = ;   
    NSString *uniqueID;
    if (retrieveuuid == nil) {
      NSString *uuid = [ UUIDString];
      uniqueID=;
      NSLog(@&#34;Create new uuid : %@&#34;,uniqueID);
      //Store the password in Keychain
      NSError *error = nil;
      ;
    }else{
      uniqueID=;
      NSLog(@&#34;uniqueID: %@&#34;,uniqueID);
    }
    return uniqueID;
}
</code></pre>

<p>以上代码在 iOS 10.0 之前运行良好。
我已经在 iPhone 7、iPhone 5s 上进行了测试,但得到了一些不同的 UUID。
我认为每次重新安装相同的应用程序时它都应该相同。
请帮帮我。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我觉得你应该试试这个,</p>

<pre><code> NSString *uniqueIdentifier = [[ identifierForVendor] UUIDString];
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 使用 iOS 10.2 在同一设备上获取不同的 UUID,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/41937006/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/41937006/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 使用 iOS 10.2 在同一设备上获取不同的 UUID