I am working on one of the application where i am promoting user for force update using UIAlertController in which i don't wanted to allow user to perform any activity until and unless he updates the application from Appstore.
To achieve this i have written following code.
if (needToUpdate)
{
var alert = UIAlertController(title: "New Version Available", message: "There is a newer version available for download! Please update the app by visiting the Apple Store.", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Update", style: UIAlertActionStyle.Default, handler: { alertAction in
UIApplication.sharedApplication().openURL(NSURL(string : "https://itunes.apple.com/app/cheapo-casino-free-casino/id637522371?ls=1&mt=8")!)
alert.dismissViewControllerAnimated(true, completion: nil)
}))
self.presentViewController(alert, animated: true, completion: nil)
}
It is working good but whenever user presses Update button it will go to app store and if user don't update the application. he/she will come back to application and can perform any activity which is not expected.
Is there any way to show the UIAlertController even if user press update button?