什么是 NSSearchPathForDirectoriesInDomains?

发布于 2024-09-07 21:19:12 字数 266 浏览 1 评论 0原文

[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]

我以前知道向对象发送消息是一种调用方法。但是,我无法识别 NSSearchPathForDirectoriesInDomains 是什么。是C风格的函数吗?如果是,那么为什么在所有 message 风格的调用中我们有这样的函数?

[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]

I used to know that sending a message to the object is kind of calling the method. However, I can't recognize what is NSSearchPathForDirectoriesInDomains. Is it C style function? If yes then why among all message style calls we have thing kind of function?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

疯狂的代价 2024-09-14 21:19:12

是的,它是一个普通的 C 函数,获取并返回 Objective-C 对象。

至于为什么......苹果可能没有找到一个很好的类来放入它。:-) 不过说真的,它可能是 UIApplicationNSApplication 上的静态方法> 或类似的,但很难证明其合理性,并且非常特定于系统(在 OS X 上你可以将它放在 NSApplication 中,在 iOS 上你可以将它放在 UIApplication 中)。

Yes, it's a plain C function taking and returning objective-c objects.

As to the why... Apple probably didn't find a nice class to put it in. :-) Seriously though, it could be a static method on UIApplication or NSApplication or similar, but it's hard to justify and quite system-specific (you'd have it in NSApplication on OS X and UIApplication on iOS).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文