[英]To update ios app when newer version is available
I am totally new to ios development. 我对ios开发完全陌生。 I have an ios7 and ios8 app which do polling to Server to check for latest version. 我有一个ios7和ios8应用程序,它们会轮询服务器以检查最新版本。 Once the latest version of app is available I am opening Alert Box(Notification) for user to update App. 提供最新版本的应用程序后,我将打开警报框(通知)供用户更新应用程序。
Will be helpful If some one can put code sample to do so. 如果有人可以放置代码示例会有所帮助。
I don't believe there's an API which you can call to update the app. 我不认为您可以调用API来更新应用程序。 The only option available is to send the user to the App Store page for your app where they will see the update button. 唯一可用的选项是将用户引导到您的应用程序的“应用程序商店”页面,他们将在其中看到更新按钮。
As far as preferences go if you're storing them in NSUserDefaults
or as a plist then they should persist unless the user deletes the application from the device. 就首选项而言,如果您将它们存储在NSUserDefaults
或作为plist存储,则它们应该保持NSUserDefaults
,除非用户从设备中删除了该应用程序。
I found the solution to my problem. 我找到了解决我问题的方法。
Every App has a unique url in the App Store. 每个应用程序在App Store中都有一个唯一的URL。
Lets assume you have updated your app from version 1.1 to 1.2 and releases app in app store. 假设您已将应用程序从版本1.1更新到1.2,并在应用商店中发布了该应用程序。
Now in the application after checking your app version you can use openURL method to redirect to the url of App in app Store 现在,在检查您的应用程序版本后,可以在应用程序中使用openURL方法重定向到应用程序商店中应用程序的URL
eg 例如
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"AppURL-String"]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@“ AppURL-String”]]];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.