如果您的應用尚未發佈,您還沒有獲得App Store鏈接。所以這是不可能的。
爲了實現這個功能您的應用程序發佈時,您可以使用下面的代碼:
斯威夫特2
let appIDString = "APP_ID" // your app ID
let reviewsURLString = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8&id=\(appIDString)"
let reviewsURL = NSURL(string: reviewsURLString)
if reviewsURL != nil && UIApplication.sharedApplication().canOpenURL(reviewsURL!) {
UIApplication.sharedApplication().openURL(reviewsURL!)
}
else {
// handle situation if reviews url cannot be opened.
}
斯威夫特3
let appIDString = "APP_ID" // your app ID
let reviewsURLString = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8&id=\(appIDString)"
let reviewsURL = URL(string: reviewsURLString)
if reviewsURL != nil && UIApplication.shared.canOpenURL(reviewsURL!) {
UIApplication.shared.openURL(reviewsURL!)
}
else {
// handle situation if reviews url cannot be opened.
}
編輯:
此鏈接適用於iOS 8和9,並直接鏈接到App Store應用程序的應用程序的評論頁面。 我對iOS 7不太確定。可能對於iOS 7,您需要使用不同的鏈接。