What is NSSearchPathForDirectoriesInDomains?

Pablo picture Pablo · Jul 5, 2010 · Viewed 28.2k times · Source
[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?

Answer

Eiko picture Eiko · Jul 5, 2010

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).