如何在应用程序中包含此App按钮的评分

时间:2012-01-14 11:52:29

标签: iphone button rate

我点按了一下按钮就可以使用此应用

-(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,nothanks,稍后。如果我点击ratethisapp,我将重定向到appstore的环形页面。如何激活这个?提前感谢。

1 个答案:

答案 0 :(得分:5)

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

无关的提示:您可以使用stringByAppendingString:和stringByAppendingFormat:方法连接字符串,这将保存一些代码,而不是当前构建字符串的方式。