简体   繁体   English

如何在移动应用中处理过时的api

[英]How to deal with obsolete api’s in a mobile app

The fictitious situation is the following: I have a mobile application that has been published to the store for about a year now (both for iOS and Android). 虚构的情况如下:我有一个已经发布到商店大约一年的移动应用程序(适用于iOS和Android)。 I'm preparing a new version of the application. 我正在准备该应用程序的新版本。 Some of the api's in the back end are obsolete or deprecated. 后端的某些api已过时或过时。

The problem is that users of the application that would not update the app to the new version will experience problems with the operation of the app because the back end api's have been replaced or removed. 问题是,不会将应用程序更新到新版本的应用程序用户将遇到应用程序操作问题,因为后端api已被替换或删除。

The question is how to deal with this situation before becoming a problem? 问题是在成为问题之前如何处理这种情况? Are there any guidelines from apple or google for obsolete functionality between different versions of the application? 苹果或谷歌是否有针对不同版本应用程序之间过时功能的指南?

@Dimitris, Here you need to provide force update to the old apps. @Dimitris,在这里您需要提供对旧应用程序的强制更新。 This can be done using app configuration file. 可以使用应用程序配置文件来完成。 Basically, you will have an app configuration file which contains JSON with following keys: 基本上,您将拥有一个应用程序配置文件,其中包含带有以下密钥的JSON:

 { "server":{ "app-server1-base-url":"http://", "status":{ "is-running":true, "message":"We are busy upgrading XYZ server with technology and features. We will be back soon. We apologize for the inconvenience and appreciate your patience. Thank you for using XYZ!" }, "force-update":{ "status":false, "message":"Please download the latest version of XYZ from App Store to continue using the app. Thank You!" } } } 

Here 'app-server1-base-url' key will be base URL for the app. 这里的“ app-server1-base-url”键将是该应用程序的基本URL。 you can put all the service URL in this file. 您可以将所有服务URL放在此文件中。

Case 1: 情况1:

Your app will check this at the time of launch whether force update available or not to the app. 您的应用在启动时会进行检查,无论该应用是否可以强制更新。

Case 2: 情况2:

API versioning can be done if you want to handle it using backend. 如果要使用后端处理API版本,则可以完成。

Note: Please keep configuration file on services like AWS S3 etc. 注意:请在AWS S3等服务上保留配置文件。

As Puneet Sharma said in this post: https://stackoverflow.com/a/18756151/8354952 . 正如Puneet Sharma在这篇文章中所说的那样: https : //stackoverflow.com/a/18756151/8354952

Almost all changes to the iOS versions are additive and hence an application build using lower version still runs on the higher iOS version. 几乎所有对iOS版本的更改都是累加的,因此使用较低版本的应用程序构建仍可以在较高iOS版本上运行。 But we also need to notice that APIs are introduced or deprecated and behaviors of existing APIs may occasionally change. 但是,我们还需要注意,已引入或弃用了API,并且现有API的行为有时可能会发生变化。

Basically the old version application may run on the latest system version. 基本上,旧版本的应用程序可以在最新的系统版本上运行。 But some special api or class may be deprecated, this will cause some weird behavior or crash. 但是可能不赞成使用某些特殊的api或类,这将导致某些奇怪的行为或崩溃。 So Apple or Google will also recommend user to update old version applications. 因此,Apple或Google也将建议用户更新旧版本的应用程序。

For the api from our own server, we can do the application compatibility by ourselves. 对于来自我们自己服务器的api,我们可以自己完成应用程序兼容性。 Upload the current version identifier, the server can transfer different types of data through detecting the identifier. 上载当前版本标识符,服务器可以通过检测到标识符来传输不同类型的数据。

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

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