Posts

Showing posts from April, 2016

Check Application version | iOS | Swift

Show the alert within application for update the application.
func checkApplicationVersion(){ let urlString = String(format: "http://itunes.apple.com/lookup?id=%@",AppleAppID) let url = NSURL(string: urlString) let urlRequest = NSURLRequest(URL: url!) NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue.mainQueue()) { (response, data, error) -> Voidin if (error == nil)             { do { let appMetadataDictionary : NSDictionary = tryNSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers) as! NSDictionary let resultsArray : NSArray = appMetadataDictionary.objectForKey("results") as! NSArray let resultsDic : NSDictionary = resultsArray.firstObjectas! NSDictionary
let iTunesVersion : String = resultsDic.objectForKey("version") as! String let appVersionString : String = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as! String if(appVersionString.compare(iTunesVersion…