Iphone 应用内购买的还原按钮-是否与再次购买相同?

Iphone 应用内购买的还原按钮-是否与再次购买相同?,iphone,xcode,ipad,in-app-purchase,Iphone,Xcode,Ipad,In App Purchase,我已经为还原按钮编写了一些代码 -(IBAction)restore:(id)sender { [[MKStoreManager sharedManager]buyFeature]; } -(void)productPurchased { for (UIView *view in self.view.subviews) { if (view.tag==2000) { [view removeFromSuperview]; } } UIAlertView *alert=[[UIAlert

我已经为还原按钮编写了一些代码

-(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];

}
但当用户按下按钮时,它会提示用户“购买”吗?这是正确的吗?我知道基本上同样的事情正在发生,因为苹果不会再向他们收费,但我不想把这段代码提交给苹果,只是因为他们拒绝了它,因为它没有说得足够清楚

还是我的代码做得不对

非常感谢您的帮助

问候,


Agnelli

我想你应该调用方法
restoreprooustransactioncomplete:onError:
,而不是
buyFeature
我想你应该调用方法
restoreprooustransactioncomplete:onError:
,而不是
buyFeature

嗯,我还是无法让它工作,你有使用上面的代码示例吗?没有;我只是查了一下你们图书馆的文件;你现在用的是什么代码?您收到了什么错误?-(iAction)restore:(id)发送方{[[MKStoreManager sharedManager]restoreprovoustransactions];}但是,这警告我,“MKStoreManager”可能不会响应其他代码中的“restoreprovoustransactions”(即将其更改为您所说的,它不喜欢该代码,尽管它是它的一个变体,编译时没有错误,但实际上不起作用:(对不起,没有更多关于什么不起作用的信息,我没什么好建议的。你为什么不尝试获取你的库的最新版本,看看你是否能让它起作用?如果它似乎也不起作用,你可以发布另一个带有更新代码的问题以及你看到的行为。它会弹出一个登录框,询问iTunes ID等,但当你把它们放进去时,它什么也不做,可能是因为我在沙盒模式下使用它?但在Xcode的调试器上,当我按下还原按钮时,它没有显示任何调用?嗯,我仍然无法让它工作,你有使用上面的代码示例吗?没有;我只是查找了你的li的文档brary;您现在使用的是什么代码?出现了什么错误?-(iAction)restore:(id)sender{[[MKStoreManager sharedManager]restoreprovoustransactions];}但是,这是在警告我,“MKStoreManager”可能不会响应其他代码中的“restoreprovoustransactions”(即将其更改为您所说的,它不喜欢该代码,尽管它是它的一个变体,编译时没有错误,但实际上不起作用:(对不起,没有更多关于什么不起作用的信息,我没什么好建议的。你为什么不尝试获取你的库的最新版本,看看你是否能让它起作用?如果它似乎也不起作用,你可以发布另一个带有更新代码的问题以及你看到的行为。它会弹出一个登录框,询问iTunes ID等,但当你把它们放进去时,它什么也不做——可能是因为我在沙盒模式下使用它?但在Xcode中的调试器上,当我按下还原按钮时,它没有显示调用了什么?