Getting iPhone Documents Directory. Is NSSearchPathForDirectoriesInDomains still the only way?

后端 未结 3 1044
星月不相逢
星月不相逢 2021-02-04 13:46

Is the NSSearchPathForDirectoriesInDomains function still the best way to get the path of the iPhone Documents directory? I ask because most topics I see on this are d

3条回答
  •  失恋的感觉
    2021-02-04 14:24

    The current Core Data iOS app template in Xcode provides this method:

    // Returns the URL to the application's Documents directory.
    - (NSURL *)applicationDocumentsDirectory
    {
        return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
    }
    

提交回复
热议问题