Is there any way for getting appstore id from running iOS application? (For asking user to rate it and providing link to appstore.)
get the app id like this
guard let bundleID = Bundle.main.infoDictionary?["CFBundleIdentifier"] as? String else {
return
}
let url = "https://itunes.apple.com/lookup?bundleId=\(bundleID)"
Alamofire.request(url).responseJSON { response in
guard let value = response.result.value else { return }
let json = JSON(value) // from: import SwiftyJSON
let storeVersion = json["results"][0]["version"].stringValue
let storeProductID = json["results"][0]["trackId"].intValue
// result: 1506562619
}