iOS跳转App Store下载应用

// 获取 AppStore 的当前app版本
https://itunes.apple.com/CN/lookup?id=appleId ,https://itunes.apple.com/lookup?id=appleId
Alamofire.request( "https://itunes.apple.com/lookup?id=\(appleId)", method:.post).responseJSON { (response) in
     guard let responseValue = response.result.value as? [String: AnyObject], let results = responseValue["results"] as? NSArray, let lastResult = results.lastObject as? NSDictionary else {
         return
     }
     guard let versionInAppStore = lastResult["version"] as? String else {
         return
     }
     ...
}

// itms-apps://itunes.apple.com/app/\(appleId) iOS7的跳转方式
// itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=\(appleId)&pageNumber=0&sortOrdering=2&mt=8 跳App Strore中App的评论页
// http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=\(appleId) 先跳Safari再跳App Strore,左上角为 返回“Safari”
// https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=\(appleId)&mt=8 跳App Strore,左上角为 返回“AppName”;http、https都可以
// itms://itunes.apple.com/us/app/apple-store/id\(appleId)?mt=8 跳iTunes Store
// https://itunes.apple.com/cn/app/AnyValue/id\(appleId)?mt=8 跳App Strore;http、https都可以
// https://itunes.apple.com/gb/app/AnyValue/id\(appleId)?mt=8 跳App Strore;http、https都可以
// https://itunes.com/apps/developerName/AppName 先跳Safari再跳iTunes Strore,跳转到开发者某个App,如果AppName为AnyValue时则跳转到他的所有App列表;http、https都可以
// http://itunes.com/apps/AppName 先跳Safari再跳iTunes Strore;http、https都可以
// itms://itunes.com/apps/AppName 跳iTunes Store
// itms-apps://itunes.com/apps/AppName 跳App Strore
let url = NSURL(string: "https://itunes.apple.com/cn/app/AnyValue/id\(appleId)?mt=8")!
if UIApplication.sharedApplication().canOpenURL(url) {
    UIApplication.sharedApplication().openURL(url)
}

你可能感兴趣的:(iOS跳转App Store下载应用)