Issues with the app interface version compatibility

Source: Internet
Author: User

Now basically every company is doing the app, so everyone is facing the issue of compatibility of the app interface version.

iOS and Android are constantly developing new versions, and many server-side developments are logically modified on previous interfaces. How is the interface compatible with older apps after new apps and interfaces are developed?

Some companies force users to update to the latest version each time they publish the app. This is not recommended because the user experience is too poor.

Even with mandatory updates, the new app interface and the old interface must be available at the same time during Apple's audit.

Below we say how to do, we use is the last way, we have different views can leave a message to discuss.

One, the client to do compatibility, interface does not have to do compatible

1, the app is forced to update (not recommended)

Interface Url:api.xxx.com/v1.0/xxxx.java

Add the version number to the URL of the interface, as above: v1.0.

Force updates every time a new app version is released.

Grayscale server deployment is being audited for the interface version (for example: v1.1). After the approval, the old version of the app settings are forced to update, so that the old interface will not be used.

Then redeploy the online server to the latest code and remove the grayscale server.

This allows the app interface to access all official online servers.

2. Hot Update

Urgent small needs can be updated with hot, big demand recommendations or native code, because you modify with the hot update (with JS or LUA), and finally in native code.

Online games with Hot update more, because the online game app is too big, it is not possible to add a small level to require users to re-download, and games updated more frequently than enterprise-class apps, with hot updates can continue to add new levels, scenes, activities to promote.

3. React Native and Weex

Weex than react native easy to use, we suggest you can try. Personal advice do not use them in large areas, after all, they are only third-party things, and some things are not perfect.

Second, the service side to do version compatibility

All interface versions are unified:

    • All interfaces use the same version number: This will be the same as the new version of the app to change the version number, good modification, but if you want to modify one of the interface version number is not.

    • The version number of each interface can be different: this is more flexible and recommended.

Because for many years has not done the service end. If there is an error in the following opinion, I hope to correct it.

1, each interface logic Riga if judgment (not recommended)

interface Url:api.xxx.com/api?version=v1&.

if (Version = = '1.5. 0  Elseif (Version = = '1.4.  0') {  do_something}

Advantages: Simple Implementation

Cons: Different versions of the logic are in one way, it is easy to cause code confusion, not conducive to maintenance.

2. Different folders

The equivalent of each interface version is a separate project. In a separate folder on the server.

For example:

Interface url:api.xxx.com/v1.0/xxxx.php

Folder location: controller/v1.0/

-----------------/xxxx.php

Folder location: CONTROLLER/V2.1/

-----------------/xxxx.php

Pros: Version logic is maintained separately. Look at the URL to know which version. Remove redundant versions without modifying the code.

Cons: Different versions of the same interface files are duplicated. And if there is an interface in the previous version of the problem, has been left to the present, you need to change several sets of code.

3, different versions of different methods:

Similar:

Interface url:api.xxx.com/v1.0/xxxx.php

class xxxx{    public  functionv1_0 () {}    public  functionv2_0 () {}}

Java or C # has a routing configuration that can be used to redirect different versions of URLs to different methods.

Third, end

I have not done a service for several years. If you have any good ways, you can leave a message, thank you.

Interface compatibility is essentially a service-side task. The app's workload is relatively simple.

How did everyone do it?

Issues with the app interface version compatibility

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.