Can I force an iPhone user to upgrade an application?

Viewed 91986

Is it possible to force the user to upgrade once there is a new version of my application available in the iTunes Store?

I am presently working on an application. However, I want to force the upgrade whenever I upload a newer version, because the upgrade will have more features and I want to discard the previous version. Is this possible by default with iPhone or do I have to write my own implementation to check the current version and compare it to the store?

16 Answers

There's no automated way to do it, you would have to write something manually.

The only way system handles updates of your application is prompting user that update is available in standard AppStore application.
Also, standalone application is not aware of available updates so you'll need to implement your web service where application can check if the current version is valid.
And I'm not sure if this conforms with Apple rules on applications, like (can't find proof-link though) you cannot upload trial versions for an application.

* EDIT * This answer is no longer true. See other upvoted answers for current truth.

Your business/design plan should never contain the phrase "force the user". People get angry when you make them do something. Imagine a user in a hurry who opens your nifty little app one morning only to discover you are forcing him to upgrade before he can use the app for what he needs. Imagine he's stuck out in the wilds having to use Edge to download. He won't be happy.

If you follow this plan long enough, one of your upgrades will inevitably introduce a noticeable bug. If you force users to use a buggy version they will rebel.

I have been conditioned by experience to cringe whenever I see "more features" used to describe a new version of software because this inevitably means feature bloat. Designers tend to keep grafting more and more features onto apps until one app does everything. This is particularly dangerous on a platform like the iPhone where making one app do to many things rapidly overwhelms the interface and the responsiveness of the app.

Edit01: My comment here How to Update an Application After Users Pay For Upgrade might also be relevant to your plans. If your upgrade design cuts Apple out of the revenue loop, its a non-starter.

Update:

Just to clarify based on a comment below: Yes, sometimes you do have to require users to upgrade. However, that is much different from designing the app from the start to force users to upgrade every time the developer releases a new version.

Such a design is intended to make the developer's life easy and not the user's. Every time a user has to spend time upgrading for a benefit they did not ask for and perhaps do not want, you've taken time and resources from the customer. Design that offload time and effort from the developer to the user are bad designs because people ultimately buy software for their own benefit. When you decrease that benefit, you decrease the softwares ultimate profitability.

So, no designer should design software that forces the users to do something the user does not wish to unless it is an absolute technical necessity. This is of course a rule of thumb but it is a very good one.

func appUpdateAvailable() -> (Bool,String?) {
        
        guard let info = Bundle.main.infoDictionary,
              let identifier = info["CFBundleIdentifier"] as? String else {
            return (false,nil)
        }
        
//        let storeInfoURL: String = "http://itunes.apple.com/lookup?bundleId=\(identifier)&country=IN"
        let storeInfoURL:String = "https://itunes.apple.com/in/lookup?bundleId=\(identifier)"
        var upgradeAvailable = false
        var versionAvailable = ""
        // Get the main bundle of the app so that we can determine the app's version number
        let bundle = Bundle.main
        if let infoDictionary = bundle.infoDictionary {
            // The URL for this app on the iTunes store uses the Apple ID for the  This never changes, so it is a constant
            let urlOnAppStore = NSURL(string: storeInfoURL)
            if let dataInJSON = NSData(contentsOf: urlOnAppStore! as URL) {
                // Try to deserialize the JSON that we got
                if let dict: NSDictionary = try? JSONSerialization.jsonObject(with: dataInJSON as Data, options: JSONSerialization.ReadingOptions.allowFragments) as! [String: AnyObject] as NSDictionary? {
                    if let results:NSArray = dict["results"] as? NSArray {
                        if let version = (results[0] as! [String:Any])["version"] as? String {
                            // Get the version number of the current version installed on device
                            if let currentVersion = infoDictionary["CFBundleShortVersionString"] as? String {
                                // Check if they are the same. If not, an upgrade is available.
                                print("\(version)")
                                if version != currentVersion {
                                    upgradeAvailable = true
                                    versionAvailable = version
                                }
                            }
                        }
                    }
                }
            }
        }
        return (upgradeAvailable,versionAvailable)
    }

You can check application build number with

Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String

Then Compare with your force update version and if you want open Appstore.

if let url = URL(string: "https://apps.apple.com/tr/app/--id--") {
    UIApplication.shared.open(url)
}

Apple does not provide any automated way to do it, you would have to write manually.

option 1. Can use the iTunes API to check the latest version for that particular App id. and show the pop-up to update the app. option 2: you can use your own server to check the latest version. but you have to update your server whenever any update went to the apple app store.

Of course there is no way. The user should make the decision if he wants to download a newer version of your application or not.

The AppStore will display if there arenew versions, so I also do not think that Apple will allow this. Also I do not know how you would do this? You could check it via an internet connection, but that's not the way Apple likes and so you won't have a chance to do this.

Related