Implementing a force update for IOS App based on a min version criteria
<p>I am developing an IOS Application. I have a use case in which we have to force users to necessarily upgrade. For example the user might be on version 1 and two more versions 2 and 3(which exists on app store currently). Now we determined that version 1 has a security vulnerability so we open an alert which asks for user to upgrade via app store. My approach right now is the follows:-</p>

<pre><code>1. Implement a rest service which vends the minimum required version. 
2. Implement a local upgrade handler that calls the rest service, 
   gets the current version(natively) and compares the version 
   against the min required version. 
3. If the version is lower than min required version, upgrade by   
   opening app store. 
</code></pre>

<p>So far I have been able to successfully implement the rest service and part of the upgrade handler. My alert view code looks as the following:-</p>

<pre><code>private func alertUserWithHandler(title: String?, message: String, upgradeHandler: ((UIAlertAction) -&gt; Void)? ){
    let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: upgradeHandler))
    self.presentViewController(alert, animated: true, completion: nil)
    AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
}
</code></pre>

<p>And my upgrade handler looks as the follows:- </p>

<pre><code>// The upgrade handler takes the user to the AppStore.
func upgradeHandler(action:UIAlertAction) {
    UIApplication.sharedApplication().openURL(NSURL(string:"location in appstore"))
}  
</code></pre>

<p>The problem with this approach is its not a blocking handler. The user might press Ok button and then go to app store and then come back to resume using the app. We want to force an upgrade (i.e the user cannot use the app until the upgrade is sucessfully completed). </p>

<p>Can anyone suggest a good way to force user upgrades? </p>