简体   繁体   中英

Where to store some information written in file in Cocoa?

I'm new in Cocoa. My app is getting information from server, and displaying UNC paths of shared folders. I want to be able to store information of my Absoulte paths for each folder, so later I can display them in my APP. With more details

UNC Path - //CompName/sharedFolder Absoulte Path -/Users/user/desktop/SharedFolder

So I need to store somewhere all that ABsolute paths locally on computer, after I can browse UNC paths from server, and display their Absoule paths.

What is the best way to store information? I know it is possible to use Core DAta. But I haven't designed for that my App. Can I store infromation in hiden file, and read it from there? How can I do it? Thanks a lot.

It looks like you are looking for the NSUserDefaults class. From the documentation:

The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. The defaults system allows an application to customize its behavior to match a user's preferences. For example, you can allow users to determine what units of measurement your application displays or how often documents are automatically saved. Applications record such preferences by assigning values to a set of parameters in a user's defaults database. The parameters are referred to as defaults since they're commonly used to determine an application's default state at startup or the way it acts by default.

You just tell it what data you want to store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM