这是我按钮的创建:
- (void)rateInfo {
UIButton *rate = [UIButton rateCreate];
[rate addTarget:self action:@selector(rateButton:) forControlEvents:UIControlEvenTouchUpInside];
[self.view addSubview:rate];
rate.frame = _mainLayout.rate;
}
这是rateButton:
方法:
#define YOUR_APP_STORE_ID XXXXXXXXXX
// and yes, I have my actual number in the code
/*
*
*
*
/
static NSString *const iOS7AppStoreURLFormat = @"itms-apps://itunes.apple.com/app/id%d";
static NSString *const iOSAppStoreURLFormat = @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d";
-(IBAction)rateButton:(id)sender {
[NSURL URLWithString:[NSString stringWithFormat:([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f)? iOS7AppStoreURLFormat: iOSAppStoreURLFormat, YOUR_APP_STORE_ID]];
}
这是我应该写出来的吗?点击率按钮时,会生成URL吗?如果是这样,我不知道为什么它不起作用。
两件事:
1. My app just went live on the store (it's a puzzle game called Twinstones if you want to try it out).
2. I'm signed into Apple when I'm trying to connect
答案 0 :(得分:0)
rateButton:
方法只是创建网址。您应该告诉应用程序打开URL。你可以这样做;
NSURL *appStoreURL = [NSURL URLWithString:[NSString stringWithFormat: iOS7AppStoreURLFormat, YOUR_APP_STORE_ID]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreURL]];
删除了iOS版本检查,因为旧网址已不再使用了。