0

我有这个代码在一个按钮点击来评价这个应用程序

-(IBAction)_clickbtnratethisApp:(id)sender
{

    NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
    str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str]; 
    str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];

    // Here is the app id from itunesconnect
    str = [NSString stringWithFormat:@"%@289382458", str]; 

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}

但是当我单击按钮时没有任何反应,我需要设置一个警报视图以显示像 ratethisapp 这样的普通警报,稍后再显示。如果我点击 ratethisapp,我将重定向到 appstore 的响铃页面。如何激活这个?提前谢谢。

4

1 回答 1

5

itms-apps: URL 语法在模拟器上不起作用,但在设备上可以正常工作,所以这可能是您的代码唯一有问题的地方,如果您在设备上尝试它会正常工作。

不相关的提示:您可以使用 stringByAppendingString: 和 stringByAppendingFormat: 方法连接字符串,与当前构建字符串的方式相比,这将节省一些代码。

于 2012-01-14T11:58:16.530 回答