简体   繁体   English

在iOS中远程更新应用程序设置的最佳方法

[英]Best way to remotely update app settings in iOS

I am working on a application in which i have to update all app related settings remotely. 我正在开发一个必须远程更新所有与应用程序相关的设置的应用程序。

App setings include 应用程序设置包括

  1. Text Font 文字字型
  2. List item 项目清单
  3. Text Color 文字颜色
  4. background Color 背景颜色
  5. Images 图片
  6. Url etc.. 网址等。

My idea is something like this, the first time when the user install the app it start downloading all images and settings like text color, font etc. And when ever any changes happen the app itself downlaod those changes and store it locally. 我的想法是这样的,当用户第一次安装该应用程序时,它开始下载所有图像和设置,例如文本颜色,字体等。一旦发生任何更改,该应用程序本身就会拒绝这些更改并将其存储在本地。

Currently i am using a constant file where i have written all required settings. 目前,我正在使用一个常量文件,其中已写入所有必需的设置。

Tell me some best way to achieve this and also tell me where to save the settings. 告诉我一些最佳方法来实现这一目标,并告诉我将设置保存到何处。

If is there any sample app available please provide me the link. 如果有可用的示例应用程序,请给我链接。

Thanks. 谢谢。

You could try something like GroundControl . 您可以尝试类似GroundControl的方法 It updates values in NSUserDefaults from a file found on a web server. 它从Web服务器上找到的文件中更新NSUserDefaults值。

If you have a constant file from which you read all your settings, you can place an identically formatted file on a server, (maybe have a "last updated" date saved inside these files). 如果您有一个读取所有设置的常量文件,则可以在服务器上放置一个格式相同的文件(这些文件中可能保存了“最后更新”日期)。 Upon every session init, try to download the remote settings file - if it is "later" than the one you have, or any settings is different than the one you have saved, save the newly downloaded file instead of the old one, and act upon the changes. 在每次会话初始化后,尝试下载远程设置文件-如果它比您拥有的文件“晚”,或者任何设置与您保存的文件不同,请保存新下载的文件而不是旧文件,然后执行操作根据变化。

The settings' flags and vars may change instantly across the app, while downloading images for skin and UI occurs immidiately after this, and take effect after they have completed downloading (which may look awkward to the user) or, more plausibly, upon init of the next session. 设置的标志和变量可能会在整个应用程序中立即更改,与此同时,皮肤和UI的下载会立即发生,并且在它们完成下载(对于用户而言可能看起来很尴尬)后才生效,或者更合理地说,在启动时下届会议。

IMHO, using NSUSerDefaults settings and downloading a remote plist with the same keys and structure is most convenient file format for settings stuff. 恕我直言,使用NSUSerDefaults设置并使用相同的键和结构下载远程plist是设置内容最方便的文件格式。

Also, you may place the remote file in a web service, and have the client send that web service the request for the file accompanied with a "my last updated settings are of the date X" - the date of the latest settings you have locally. 另外,您可以将远程文件放置在Web服务中,并让客户端向该Web服务发送文件请求,并附上“我的最新更新设置的日期为X”-您在本地拥有的最新设置的日期。 Then, the server may return a file, or an "you already have the latest file" response. 然后,服务器可能返回一个文件,或“您已经有最新文件”响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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