I have a few thousand literal strings in my app.
我的应用程序中有几千个文字字符串。
I currently have them all listed in my .m file.
我目前将它们全部列在我的.m文件中。
I don't have a problem doing it this way, and it works for my app.
这样做我没有问题,它适用于我的应用程序。
Is this not a best practice? Should I house my string data in an external DB?
这不是最佳做法吗?我应该将我的字符串数据存放在外部数据库中吗?
Thank You.
谢谢。
2 个解决方案
#1
1
Several thousand literal strings sounds annoying, but that's the worst of it. A database probably would be overkill and hard to maintain. So long as you can localize your app when/if you need to, it should be fine.
几千个字符串听起来很烦人,但这是最糟糕的。数据库可能过度且难以维护。只要您可以在需要时本地化您的应用程序,它应该没问题。
#2
-1
This is the kind of thing SQLite was MEANT for.
这就是SQLite想要的东西。
The minute you instantiate that object, all those strings are taking up memory, including the vast majority of which you probably won't use on any particular trip through the app. I'd sure rather have a database I could just query up the ones I need.
在您实例化该对象的那一刻,所有这些字符串都占用了内存,其中绝大多数都是您在应用程序的任何特定行程中都不会使用的内存。我肯定有一个数据库,我可以查询我需要的数据库。
#1
1
Several thousand literal strings sounds annoying, but that's the worst of it. A database probably would be overkill and hard to maintain. So long as you can localize your app when/if you need to, it should be fine.
几千个字符串听起来很烦人,但这是最糟糕的。数据库可能过度且难以维护。只要您可以在需要时本地化您的应用程序,它应该没问题。
#2
-1
This is the kind of thing SQLite was MEANT for.
这就是SQLite想要的东西。
The minute you instantiate that object, all those strings are taking up memory, including the vast majority of which you probably won't use on any particular trip through the app. I'd sure rather have a database I could just query up the ones I need.
在您实例化该对象的那一刻,所有这些字符串都占用了内存,其中绝大多数都是您在应用程序的任何特定行程中都不会使用的内存。我肯定有一个数据库,我可以查询我需要的数据库。