解決方法很簡單,增加一個Restore按鈕,并調用[[SKPaymentQueue defaultQueue] restoreCompletedTransactions],接下來的流程是
1,彈出對話框輸入帳號信息
2,如果點擊“取消”,調用方法
-(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error
如果點擊“確定”,開始請求數(shù)據(jù)
3,返回數(shù)據(jù)后,回調
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
4,判斷交易隊列中交易的狀態(tài),在狀態(tài)為“SKPaymentTransactionStateRestored”的switch分支下調用恢復處理方法
5,恢復完成后回調-(void)completeTransaction:(SKPaymentTransaction *)transaction