简体   繁体   中英

Best way to store a large amount of static information in an iOS app?

If I have a large amount of information that will be randomly used while the app is being used, what is the best way to store and access that data?

The app completely relies on the static text that I have and will need to grab certain parts and concatenate them depending on what the user selects within the app.

Is it best to load it into Core Data when the app loads the first time and then check if it is loaded every time after that? If so, how?

Core Data's primary focus is not persisting data but instead on managing a complex graph of objects that contain and manipulate data. The API is intended to create the entire model layer of a Model-View-Design application.

If you have a lot of chunks of text all that need separate logic or if your app will create those chunks out of a large body of text, then core data is a good choice.

If you just have something like a very basic text editor then probably not.

Core Data is completely inappropriate for your use case.

Store your text in a .strings file and use NSLocalizedString() to access it. This will provide a convenient way to lookup text by key and make localization simple.

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