简体   繁体   English

iOS - 提示用户更新到最新的应用版本

[英]iOS - Prompt User to Update to Latest App Version

Is there any method or plugin available that will alert the user to upgrade an app if the version they are using is not the latest? 是否有任何方法或插件可以提醒用户升级应用程序,如果他们使用的版本不是最新的? I suppose I could ping a web service to check what the current version is and compare with the user's version and go from there. 我想我可以ping一个Web服务来检查当前版本是什么,并与用户的版本进行比较,然后从那里开始。 As an aside, is there a way to check the current version of the app (some property I don't know about) or do you simply have to hardcode the version as some float variable or something? 顺便说一下,有没有办法检查应用程序的当前版本(我不知道的一些属性)或者你只需​​要将版本硬编码为某些浮点变量或其他东西?

Thanks 谢谢

There's a nice little open source library available called Harpy that will accomplish this for you! 有一个很好的小型开源库叫做Harpy ,可以为你完成这个! It provides the ability to check for updates on startup, daily, or weekly, and it uses itunes to do the checking, so config is really minimal. 它提供了在启动时,每天或每周检查更新的功能,并使用itunes进行检查,因此配置非常少。

you will need to build the update check functionality yourself. 您需要自己构建更新检查功能。 however you can get the version info from the app. 但是你可以从应用程序中获取版本信息。

NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];

Bear in mind tho that just because you have an app up. 请记住,因为你有一个应用程序。 and it has been released into the store. 它已被释放到商店。 that does not mean the app is immediately available to all users via the app store. 这并不意味着应用程序可以通过应用商店立即供所有用户使用。

You'll have to build such a solution yourself. 您必须自己构建这样的解决方案。 There's no update-checking functionality provided by the iOS SDK. iOS SDK没有提供更新检查功能。

Most apps just check a website or similar, as you've already considered. 大多数应用只是检查一个网站或类似的,正如你已经考虑过。

You can grab the version from the info.plist with 你可以从info.plist中获取版本

    NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
self.applicationVersion = [infoDict objectForKey:@"CFBundleVersion"];
self.applicationBuild = [infoDict objectForKey:@"CFBundleShortVersionString"];

And, yes just hit a web service. 而且,是的,只需点击一个Web服务。 Or even easier you could just put a file up on S3 and update that with your version number. 或者甚至更简单,您可以将文件放在S3上并使用您的版本号更新。

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

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