ios - [[NSUUID new] UUIDString] 和 CFUUIDRef 之间有什么区别
<p><p>任何人都可以让我知道通过下面给出的这两种实现创建唯一 ID 之间的区别是什么</p>
<p>1)</p>
<pre><code>CFUUIDRef cfuuid = CFUUIDCreate(kCFAllocatorDefault);
NSString *udidString = (NSString*)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, cfuuid));
</code></pre>
<p>2) <code>NSString *guid = [ UUIDString];</code></p>
<p>哪个更可靠,因为我正在开发来自 IOS 8 及更高版本的应用程序。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以在 <a href="http://nshipster.com/uuid-udid-unique-identifier/" rel="noreferrer noopener nofollow">NSHipster's uuid-udid-unique-identifier post</a> 上找到详细信息.</p>
<p>为了<em>不</em>在此处发布“仅链接”答案是同一篇文章的摘录:</p>
<blockquote>
<p>NSUUID was added to Foundation in iOS 6 as a way to easily create
UUIDs.</p>
<p>If your app targets iOS 5 or earlier, however, you have to settle for
Core Foundation functions on CFUUIDRef</p>
</blockquote>
<p>总而言之,虽然两者都返回有效的 UUID,但继续使用 NSUUID 更容易。</p></p>
<p style="font-size: 20px;">关于ios - [ UUIDString] 和 CFUUIDRef 之间有什么区别,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/33492481/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/33492481/
</a>
</p>
页:
[1]