什么是 NSSearchPathForDirectoriesInDomains?
[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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,它是一个普通的 C 函数,获取并返回 Objective-C 对象。
至于为什么......苹果可能没有找到一个很好的类来放入它。:-) 不过说真的,它可能是
UIApplication
或NSApplication
上的静态方法> 或类似的,但很难证明其合理性,并且非常特定于系统(在 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
orNSApplication
or similar, but it's hard to justify and quite system-specific (you'd have it inNSApplication
on OS X andUIApplication
on iOS).查看
http://www.techotopia.com/index.php/Working_with_Directories_on_iPhone_OS 和 http://iphonedevelopmentblog.blogspot.com/2011/03/documents- Directory-file-path-iphone.html
我正在研究相同的材料,这些链接提供了有关该主题的详尽信息。
Check out
http://www.techotopia.com/index.php/Working_with_Directories_on_iPhone_OS and http://iphonedevelopmentblog.blogspot.com/2011/03/documents-directory-file-path-iphone.html
I was studying the same material, and these links provide exhaustive information on the subject.