How to make app update available to users in the f

2019-03-07 08:23发布

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.

enter image description here

2条回答
劳资没心,怎么记你
2楼-- · 2019-03-07 08:44

simple, first you have to create design to show new updates screen is available in each build you upload. then make api that fill info in updates screen and store flag in device locally, so whenever user open your app new update screen showed. Yes for this you need to call new version api every time when user open your app or you can use push notification to pass as well.

You have to create to API 1st) api is return currently uploaded version on app store and 2nd) api is to get data that you want to show in your new updates available screen

step 1 : create screen design of update screen in your application.

step 2 : create API that return current version in app store, call this api in your app and check version is same or not.

step 3 : if version is not same than call Data API and store them in locally.

step 4 : if new updates data is available and version not same than show your new updates available screen when user open your app.

step 5 : after user updates app then check version and remove previous loaded data.

查看更多
3楼-- · 2019-03-07 08:55

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

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.

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: "http://itunes.apple.com/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
    }

Call this function in you func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool function of 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
}
查看更多
登录 后发表回答