2012-07-12 29 views
0

我寫了一些恢復按鈕的代碼;應用程序內購買的恢復按鈕 - 是否與重新購買相同?

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

} 

但它會提示用戶按下時「購買」它?它是否正確?我知道基本上同樣的事情正在發生,因爲它不會再對它們收費,但是我不想將這些代碼提交給蘋果,僅僅因爲它沒有足夠清楚的事實而拒絕它。

或者我錯誤地完成了代碼?

您的幫助將是巨大的讚賞,

問候,

阿涅利

回答

3

我想你要調用的方法restorePreviousTransactionsOnComplete:onError:,不buyFeature

+0

嗯,我仍然不能得到它的工作,你有一個代碼示例使用上述? – Agnelli 2012-07-12 19:40:24

+0

不是;我只是爲你的圖書館查閱文檔;你現在用什麼代碼?你遇到了什麼錯誤? – 2012-07-12 19:46:22

+0

- (IBAction)還原:(id)發件人 {[MKStoreManager sharedManager] restorePreviousTransactions]; } 但是,警告我說,「MkStoreManager」不能爲「restorePreviousTransactions」 其他響應代碼(即它改變對你說什麼,它不喜歡的代碼,雖然它的一個變種,工作沒有錯誤的編譯,但是實際上並沒有工作:( – Agnelli 2012-07-12 19:57:14