如何检查CFPropertyList的类型?

When using the CFPreferences API to store and retrieve per user and machine wide app settings on Mac OS X, the CFPreferencesCopyAppValue returns a CFPropertyListRef to represent the retrieved setting.

I can't seem to find code that lets me safely test that the CFPropertyList is actually a CFString so I can trust that the result is the string I am looking for.

Whats the proper method for transforming CFPropertyList objects back into CFString / CFNumber / CFWhateverElse?

#0

You can use the CFGetTypeID function:

if (CFGetTypeID(myPropertyListRef) == CFStringGetTypeID()) {
    // it's really a string!
}

推荐文章

何时使用Helpers而不是Partials

何时使用Helpers而不是Partials

推荐文章

存储巨大的std::map,主要在磁盘上

存储巨大的std::map,主要在磁盘上

推荐文章

Which unknown/smaller web development blogs do you read? ????????

Which unknown/smaller web development blogs do you read? ????????

推荐文章

ArrayList和添加项的问题

ArrayList和添加项的问题

推荐文章

delphi批量存入多媒体字段 遇到内存溢出的坑

delphi批量存入多媒体字段 遇到内存溢出的坑

推荐文章

什么是欣德利·米尔纳?

什么是欣德利·米尔纳?

推荐文章

检测是否使用Javascript正确加载了Flash应用程序?

检测是否使用Javascript正确加载了Flash应用程序?

推荐文章

What's a better way to start a conference talk than "Uh... okay, so I guess it's time to get started?"

What's a better way to start a conference talk than "Uh... okay, so I guess it's time to get started?"

推荐文章

sqlserver还原数据库

sqlserver还原数据库

推荐文章

对C#/Silverlight工作流感到困惑

对C#/Silverlight工作流感到困惑

推荐文章

Tix和Python 3.0

Tix和Python 3.0

推荐文章

在PHP中检索的最快方法</a> </p> <p class=" rounded py-1" style="color: #888;"> 在PHP中检索的最快方法 </p> </div> </div> </div> <div class="feed-item break-all bg-white mb-2 card-item py-2 rounded-lg card-item py-2 pb-3 " style="box-shadow: 0 2px 4px 0 rgba(0,0,0,.05);"> <p class="ml-5 text-sm text-gray-600 flex items-center py-1"> 推荐文章 </p> <div class=" border-gray-400 px-4 mb-1 flex items-center"> <div class="text-base pl-2"> <p class="text-gray-900 "> <a href="/c87b84b71c2a8966" class=" text-lg font-bold">What was your win this week?</a> </p> <p class=" rounded py-1" style="color: #888;"> What was your win this week? </p> </div> </div> </div> <div class="feed-item break-all bg-white mb-2 card-item py-2 rounded-lg card-item py-2 pb-3 " style="box-shadow: 0 2px 4px 0 rgba(0,0,0,.05);"> <p class="ml-5 text-sm text-gray-600 flex items-center py-1"> 推荐文章 </p> <div class=" border-gray-400 px-4 mb-1 flex items-center"> <div class="text-base pl-2"> <p class="text-gray-900 "> <a href="/399339" class=" text-lg font-bold">跨平台开源Doc-to-RTF转换器</a> </p> <p class=" rounded py-1" style="color: #888;"> 跨平台开源Doc-to-RTF转换器 </p> </div> </div> </div> <div class="feed-item break-all bg-white mb-2 card-item py-2 rounded-lg card-item py-2 pb-3 " style="box-shadow: 0 2px 4px 0 rgba(0,0,0,.05);"> <p class="ml-5 text-sm text-gray-600 flex items-center py-1"> 推荐文章 </p> <div class=" border-gray-400 px-4 mb-1 flex items-center"> <div class="text-base pl-2"> <p class="text-gray-900 "> <a href="/0886f4d1c7feac4a" class=" text-lg font-bold">pro*c的使用</a> </p> <p class=" rounded py-1" style="color: #888;"> pro*c的使用 </p> </div> </div> </div> <div class="feed-item break-all bg-white mb-2 card-item py-2 rounded-lg card-item py-2 pb-3 " style="box-shadow: 0 2px 4px 0 rgba(0,0,0,.05);"> <p class="ml-5 text-sm text-gray-600 flex items-center py-1"> 推荐文章 </p> <div class=" border-gray-400 px-4 mb-1 flex items-center"> <div class="text-base pl-2"> <p class="text-gray-900 "> <a href="/399340" class=" text-lg font-bold"><label>在复选框上:有没有理由让更多的网站不使用它?</a> </p> <p class=" rounded py-1" style="color: #888;"> 在复选框上:有没有理由让更多的网站不使用它? </p> </div> </div> </div> <nav> <ul class="pagination"> <li class="page-item disabled" aria-disabled="true"> <span class="page-link">« 上一页</span> </li> <li class="page-item"> <a class="page-link" href="http://huati365.com/5258664?page=2" rel="next">下一页 »</a> </li> </ul> </nav> </div> </div> <div class="w-full sm:mt-2 sm:w-12/12 md:w-4/12 lg:w-4/12 "> <div class="mx-2 overflow-hidden"> <!--start--> <div style="height:700px;width:100%;"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- 侧边栏众向广告 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-7679730964216360" data-ad-slot="7642024367" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <!--end--> </div> </div> </div> </div> <script src="http://huati365.com/highlight.js" defer></script> <script src="http://huati365.com/app.js" defer></script> <footer class="footer bg-secondary mt-10 relative"> <div class="container mx-auto px-6"> <!-- <nav class="my-3 lg:mt-0 menu-inside flex flex-col lg:flex-row items-center"> <a href="//portal.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">门户</a> <a href="//books.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">图书</a> <a href="//ebooks.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">电子书</a> <a href="//blog.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">博客</a> <a href="//yuanjie.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">猿界</a> <a href="//website.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">网址</a> <a href="//tag.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">标签云</a> <a href="//shandu.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">文学</a> <a href="//baike.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">百科</a> <a href="//data.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">数据界</a> <a href="//youda.huati365.com" class="py-4 lg:py-2 lg:px-4 sm:text-secondary opacity-75 hover:opacity-100">有答</a> </nav> --> <div class=" border-t border-teal-300 flex flex-col items-center"> <div class="sm:w-2/3 text-center py-6"> <p class="text-base mb-2">©2020-2025 天天话题 <a href="http://www.beian.miit.gov.cn/" target="_blank"><b>京ICP备14028175号</b></a></p> </div> </div> </div> </footer> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-TKLB94J2XW"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-TKLB94J2XW'); </script> <script> (function() { var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> <!--360 自动收录--> <script> (function(){ var src = "https://s.ssl.qhres2.com/ssl/ab77b6ea7f3fbf79.js"; document.write('<script src="' + src + '" id="sozz"><\/script>'); })(); </script> <script> document.addEventListener("DOMContentLoaded", event => { document.querySelectorAll("pre").forEach(block => { hljs.highlightBlock(block); }); }); //菜单 hover document.querySelectorAll(".nav-top > li").forEach(element => { element.addEventListener("mouseover", event => { element.childNodes[3].classList.remove("hidden"); }); element.addEventListener("mouseout", event => { element.childNodes[3].classList.add("hidden"); }); }); </script> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-138053197-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'UA-138053197-1'); </script> </body> </html>