Modal App Store不会解雇

Ste*_*eve 2 app-store modalviewcontroller ios ios6

我有一个按钮,在模态视图中显示我的应用程序,以便人们可以下载并评估应用程序.我得到它用这个代码模态显示.

 NSDictionary *appParameters = [NSDictionary dictionaryWithObject:@"607257427"
                           forKey:SKStoreProductParameterITunesItemIdentifier];
     SKStoreProductViewController *productViewController = [[SKStoreProductViewController alloc] init];
    [productViewController setDelegate:self];
    [productViewController loadProductWithParameters:appParameters
                                     completionBlock:^(BOOL result, NSError *error)
    {

    }];
    [self presentViewController:productViewController
                       animated:YES
                     completion:^{

                     }];
Run Code Online (Sandbox Code Playgroud)

`

这就是它的结果.在此输入图像描述

问题是取消按钮不起作用,它可能是模拟器或某些非常简单的东西,但我无法弄清楚为什么取消按钮不起作用

Und*_*ndo 5

您需要实现委托方法来关闭视图控制器:

- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController
{
    [viewController dismissViewControllerAnimated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)