如何向尚未发布的应用程序添加评分按钮?
How do I add a rate me button to an app that has not been released?
所以我要在 App Store 上发布一个应用程序。我的问题是我有一个评价我的应用程序的按钮,但我不知道在那里插入正确的代码。
我的朋友们在他们的应用程序上试过这个并且说它不好:
有人知道我该如何解决这个问题吗?
let iTunesReviewPageLink = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=1073785561&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8"
// Go directly to review page on App Store
if let url = NSURL(string: iTunesReviewPageLink) {
UIApplication.sharedApplication().openURL(url)
}
唯一不知道的就是ID,对吧?您可以在发布应用程序之前查看其 ID - 一旦您在 iTunes Connect 中对其进行设置。
如果您的应用尚未发布,则说明您还没有 App Store link。所以那是不可能的。
为了在您的应用发布时实现此功能,您可以使用以下代码:
Swift 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.
}
Swift 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.
}
编辑:
此 links 在 iOS 8 和 9 和 links 中直接用于 App Store 应用程序中应用程序的评论页面。
我不确定 iOS 7。可能 iOS 7 你需要使用不同的 link.
所以我要在 App Store 上发布一个应用程序。我的问题是我有一个评价我的应用程序的按钮,但我不知道在那里插入正确的代码。
我的朋友们在他们的应用程序上试过这个并且说它不好:
有人知道我该如何解决这个问题吗?
let iTunesReviewPageLink = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=1073785561&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8"
// Go directly to review page on App Store
if let url = NSURL(string: iTunesReviewPageLink) {
UIApplication.sharedApplication().openURL(url)
}
唯一不知道的就是ID,对吧?您可以在发布应用程序之前查看其 ID - 一旦您在 iTunes Connect 中对其进行设置。
如果您的应用尚未发布,则说明您还没有 App Store link。所以那是不可能的。
为了在您的应用发布时实现此功能,您可以使用以下代码:
Swift 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.
}
Swift 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.
}
编辑:
此 links 在 iOS 8 和 9 和 links 中直接用于 App Store 应用程序中应用程序的评论页面。 我不确定 iOS 7。可能 iOS 7 你需要使用不同的 link.