我已经为恢复按钮编写了一些代码;
-(IBAction)restore:(id)sender
{
[[MKStoreManager sharedManager]buyFeature];
}
-(void)productPurchased
{
for (UIView *view in self.view.subviews)
{
if (view.tag==2000)
{
[view removeFromSuperview];
}
}
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Thank you" message:@"Your restore was successful." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
// error restore
- (void)failed
{
for (UIView *view in self.view.subviews)
{
if (view.tag==2000)
{
[view removeFromSuperview];
}
}
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error" message:@"Your restore has failed." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
但它会在用户按下时提示用户“购买”?它是否正确?我知道基本上同样的事情正在发生,因为它不会再次向他们收取费用,但是我不想将这些代码提交给苹果只是为了让他们拒绝它,因为它不够清楚吗?
或者我错误地完成了代码?
非常感谢您的帮助,
此致
阿涅利
答案 0 :(得分:3)
我认为你想要调用方法restorePreviousTransactionsOnComplete:onError:
,而不是buyFeature
。