简体   繁体   中英

NSUserDefault persisance advantages and disadvantages?

I am new to NSUserDefault

1) what kind of data can we store in NSUserDefault and cant we store in NSUserDefault?

2) can We achieve RDMS concepts in NSUserDefault like SQlite?

3) where is it stored and can we acces it directly like Sqlite?

1) what kind of data can we store in NSUserDefault and cant we store in NSUserDefault?

You can save app status, game scores, preference etc. Please don't store sensitive information like password, credit card information etc in NSUserDefaults. For that use Keychain services .

2) can We achieve RDMS concepts in NSUserDefault like SQlite?

NSUserDefault is entirely different from SQLite, or any other database. It is just used to store lightweight objects like app preferences and states. It is not designed for heavy data storage at all.

3)where is it stored and can we acces it directly like Sqlite?

NSUserDefault values are stored as plist files under Library->Preference in your app bundle. You can access it like any plist files

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