[英]Adding a NSMutableArray which is Parsed XML value to a AppDelegate good or bad?
Is adding a NSMutableArray
which is Parsed XML value to a AppDelegate
good or bad practice? 是否在
AppDelegate
添加了将XML值解析为NSMutableArray
好习惯?
Im trying to find the best solution for a fairly large XML that gets parsed and then added to a NSMutableArray
. 我试图为解析后添加到
NSMutableArray
的相当大的XML找到最佳解决方案。
It's not a good practice to save data in AppDelegate
. 在
AppDelegate
保存数据不是一个好习惯。 AppDelegate should be used for initialization and for receiving application level events as a mediator between OS and Application. AppDelegate应该作为OS和Application之间的中介程序用于初始化和接收应用程序级事件。
You can create a singleton DataManager
which will keep all the data fetched in a session. 您可以创建一个单例
DataManager
,以将所有数据保留在会话中。 Make Composite Model objects
for your structures and keep them as collections in DataManager. 为您的结构制作
Composite Model objects
,并将其保留为DataManager中的集合。 If you can provide more information about the type of data you are trying to persist, we can provide suggestions. 如果您可以提供有关您要保留的数据类型的更多信息,我们可以提供建议。
More read on Singleton Objects 有关单例对象的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.