在XCode中检查应用程序API版本? [英] Checking Application API Version in XCode?

查看:39
本文介绍了在XCode中检查应用程序API版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
在新版本的iOS应用可用时发出警告

我需要可以嵌入到我的项目代码中的代码,以便从应用程序到服务器的每个请求都包含API版本,以防我的iPhone应用程序获得新的更新,以便它可以通知用户更新应用程序的新版本

I need code that I can embedd into my project code so that every request from the application to server contains the API version in case my iPhone app gets a new update so it can notify the user to update the new version of the application.

我应该在哪里添加代码以进行检查以及需要哪一行代码.我没有遵循正确的程序.

Where should I add the code to check this and what line of code is needed for it. I am not getting the right procedure to follow.

请帮助,谢谢.

推荐答案

您可以这样做:

  1. 只需在服务器端创建一个单独的Web服务,其参数即为应用程序版本.

  1. Just create the separate web-service on server side which have parameter as app version.

在服务器端设置包含应用程序最新版本的全局变量.

Set the global variable on server side which holds the latest version of the app.

现在,从您的应用程序中启动应用程序时,然后使用应用程序中使用的api版本的参数调用此服务.(此api版本将是静态的,因为您已经完成了相同的代码.并且,当您更新应用程序时,您将自己更改api代码.希望您理解).

Now, from your application, when app will be launched, then call this service with the parameter of api version used in the app. (this api version will be static, because you have done the code for same. And when you will update your app then you will change the api code yourself. Hope you understand).

在服务器端检查api版本,如果应用程序api使用最新版本,则返回TRUE.如果应用程序上的api使用较低版本,则返回FALSE.

Check the api version on server side, and if app api using latest version then return TRUE. And if api on app using lower version then return FALSE.

现在,在应用程序中,如果Web服务返回FALSE,则只需通过ALERT通知用户,他正在使用api的较低版本,并下载最新的应用程序以使用最新的api.

Now, in application, if web-service returns the FALSE then just inform the user by ALERT that, he is using the lower version of the api and download latest app to use the latest api.

希望,您已经知道该怎么做.

Hope, you got an idea of what to do.

干杯.

这篇关于在XCode中检查应用程序API版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆