我想把一个“率/审查这个应用程序”功能到我的应用程序。

是否存在一种方法能够直接链接到应用商店中他们评论应用的屏幕?所以用户不需要点击主应用程序链接。谢谢。

编辑:由于缺乏回应,开始赏金。为了确保这一点非常清楚:我知道我可以链接到应用商店中我的应用页面,并让用户从那里点击到“审查这款应用”屏幕。问题是是否有可能直接链接到“审查这个应用程序”屏幕,这样他们就不需要点击任何东西。


当前回答

使用这个URL对我来说是完美的解决方案。它将用户直接带到Write a Review部分。感谢@Joseph Duffy。必须努力

URL = itms-apps://itunes.apple.com/gb/app/idYOUR_APP_ID_HERE?action=write-review&mt=8 用你的AppId替换YOUR_APP_ID_HERE

对于一个示例代码,请尝试这样做:

Swift 3, Xcode 8.2.1:

 let openAppStoreForRating = "itms-apps://itunes.apple.com/gb/app/id1136613532?action=write-review&mt=8"
 if let url = URL(string: openAppStoreForRating), UIApplication.shared.canOpenURL(url) {
      UIApplication.shared.openURL(url)
 } else {
      showAlert(title: "Cannot open AppStore",message: "Please select our app from the AppStore and write a review for us. Thanks!!")
 }

这里showAlert是UIAlertController的自定义函数。

其他回答

在iOS 11+(新的应用商店)中有一种新方法来做到这一点。您可以直接打开“Write a Review”对话框。

以iOS 11为例:

itms-apps://itunes.apple.com/us/app/id1137397744?action=write-review

or

https://itunes.apple.com/us/app/id1137397744?action=write-review

注:

需要国家代码(/us/)。可以是任何国家代码,没关系。 将应用id(1137397744)更改为您的应用id(从iTunes URL获取)。 如果你想要支持旧的iOS版本(11之前),你需要一些条件逻辑,只有当OS版本大于或等于11时才会以这种方式链接。

以上方法都是正确的,但是现在使用SKStoreProductViewController可以带来更好的用户体验。要使用它,你需要做以下工作:

implement SKStoreProductViewControllerDelegate protocol in your app delegate add required productViewControllerDidFinish method: - (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController { [viewController dismissViewControllerAnimated: YES completion: nil]; } Check if SKStoreProductViewController class is available and either show it or switch to the App Store: extern NSString* cAppleID; // must be defined somewhere... if ([SKStoreProductViewController class] != nil) { SKStoreProductViewController* skpvc = [[SKStoreProductViewController new] autorelease]; skpvc.delegate = self; NSDictionary* dict = [NSDictionary dictionaryWithObject: cAppleID forKey: SKStoreProductParameterITunesItemIdentifier]; [skpvc loadProductWithParameters: dict completionBlock: nil]; [[self _viewController] presentViewController: skpvc animated: YES completion: nil]; } else { static NSString* const iOS7AppStoreURLFormat = @"itms-apps://itunes.apple.com/app/id%@"; static NSString* const iOSAppStoreURLFormat = @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@"; NSString* url = [[NSString alloc] initWithFormat: ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f) ? iOS7AppStoreURLFormat : iOSAppStoreURLFormat, cAppleID]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]]; }

斯威夫特3

fileprivate func openAppStore() {
        let appId = "YOUR_APP_ID"
        let url_string = "itms-apps://itunes.apple.com/app/id\(appId)"
        if let url = URL(string: url_string) {
            UIApplication.shared.openURL(url)
        }
    }

通过SKStoreProductViewController链接到AppStore中的任何应用程序

很容易通过SKStoreProductViewController链接到应用商店的应用程序。但是我有点纠结,所以我决定在这里展示整个过程和一些必要的代码。这种技术还可以确保始终使用正确的商店(对于本地化应用程序很重要)。

要在你的应用程序商店中显示任何应用程序的产品屏幕,你的任何应用程序ViewControllers遵循以下步骤:

在项目设置中添加StoreKit.framework(目标,构建阶段->链接二进制库 导入StoreKit到ViewController类中 使你的ViewController符合这个协议 SKStoreProductViewControllerDelegate 创建方法,将StoreView显示为所需的产品屏幕 解散StoreView

但最重要的是:出于某种原因,这在模拟器中不起作用——你必须在具有互联网连接的真实设备上构建和安装。

添加StorKit.framework到你的项目:

SWIFT 4:这是根据前面描述的步骤编写的代码:

    // ----------------------------------------------------------------------------------------
// 2. Import StoreKit into the ViewController class
// ----------------------------------------------------------------------------------------
import StoreKit

// ...

// within your ViewController

    // ----------------------------------------------------------------------------------------
    // 4. Create the method to present the StoreView with the product screen you want
    // ----------------------------------------------------------------------------------------
    func showStore() {
        
        // Define parameter for product (here with ID-Number)
        let parameter : Dictionary<String, Any> = [SKStoreProductParameterITunesItemIdentifier : NSNumber(value: 742562928)]
        
        // Create a SKStoreProduktViewController instance
        let storeViewController : SKStoreProductViewController = SKStoreProductViewController()
        
        // set Delegate
        storeViewController.delegate = self
        
        // load product
        storeViewController.loadProduct(withParameters: parameter) { (success, error) in
        
            if success == true {
                // show storeController
                self.present(storeViewController, animated: true, completion: nil)
            } else {
                print("NO SUCCESS LOADING PRODUCT SCREEN")
                print("Error ? : \(error?.localizedDescription)")
            }
        }
    }
    
// ...

// ----------------------------------------------------------------------------------------
// 3. Make your ViewController conforming the protocol SKStoreProductViewControllerDelegate
// ----------------------------------------------------------------------------------------
extension ViewController : SKStoreProductViewControllerDelegate {
    
    // ----------------------------------------------------------------------------------------
    // 5. Dismiss the StoreView
    // ----------------------------------------------------------------------------------------
    func productViewControllerDidFinish(_ viewController: SKStoreProductViewController) {
        print("RECEIVED a FINISH-Message from SKStoreProduktViewController")
        viewController.dismiss(animated: true, completion: nil)
    }
}

这在iOS 9 - 11上运行良好。

还没有测试早期版本。

[NSURL URLWithString:@"https://itunes.apple.com/app/idXXXXXXXXXX?action=write-review"];