如何以迷人的屏幕形式向用户提供应用更新?

编程入门 行业动态 更新时间:2024-10-24 21:31:14
本文介绍了如何以迷人的屏幕形式向用户提供应用更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我最近使用Make My Trip应用。每当我启动应用程序时,我都会发现一个非常有吸引力的应用更新弹出屏幕。它说要更新应用程序。我想在我的应用更新中加入它。请告诉我怎么做。 我附上一张截图供您考虑。

I was recently using "Make My Trip" app. I found a very attractive app update pop up screen appearing whenever I launch the app. It says to update the app. I want to incorporate that in my app update too. Please tell me how can I do it. I am attaching a screenshot here for your consideration.

推荐答案

您可以从 iTunes商店查找API : itunes.apple/lookup?bundleId=YOUR_BUNDLE_ID ,在此您可以在App Store上获得App版本。

You can get all App info from iTunes store lookup API: itunes.apple/lookup?bundleId=YOUR_BUNDLE_ID, in this you can get App version on App Store.

制作您的设计屏幕,以便向App用户展示,然后在App Store和App上比较您的App版本。用户的设备,如果两个版本不相等,则显示更新版本屏幕。

Make your design screen as you want to show your App users, Then compare your App version on App store & user's device, if both version not equal then show the update version screen.

以下是在App Store和App上比较应用版本的完整实现。设备:

Below is the complete implementation to compare app version on App store & device:

func isUpdateAvailableOnStore() -> Bool { let infoDictionary = Bundle.main.infoDictionary let bundleId = infoDictionary!["CFBundleIdentifier"] as! String let url = URL(string: "itunes.apple/lookup?bundleId=\(bundleId)") let infoData = try? Data(contentsOf: url!) let appInfo = (try? JSONSerialization.jsonObject(with: infoData! , options: [])) as? [String: Any] if let resultCount = appInfo!["resultCount"] as? Int, resultCount == 1 { if let results = appInfo!["results"] as? [[String:Any]] { if let appStoreVersion = results[0]["version"] as? String{ let currentAppVersion = infoDictionary!["CFBundleShortVersionString"] as? String if !(appStoreVersion == currentAppVersion) { return true } } } } return false }

在你的 func应用程序中调用此函数(_ application:UIApplication,didFinishLaunchingWithOptions launchOptions:[UIApplicationLaunchOptionsKey:Any]?) - > Bool 的功能AppDelegate 。

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Your code here if self.isUpdateAvailableOnStore(){ // SHOW YOUR UPDATE SCREEN TO USER'S }else{ // APP VERSION IS UPDATED ON DEVICE } return true }

更多推荐

如何以迷人的屏幕形式向用户提供应用更新?

本文发布于:2023-10-30 04:03:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541704.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户提供   迷人   屏幕   形式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!